> ## Documentation Index
> Fetch the complete documentation index at: https://ownpay.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> OwnPay is licensed under AGPL-3.0 and is completely free - no licensing fees.
> Production docs URL: https://ownpay.org/docs - append .md to any page URL for clean markdown.
> OwnPay requires PHP 8.3+, MySQL/MariaDB, and Redis.
> MCP server available at https://ownpay.org/docs/mcp for programmatic documentation queries.
> Use root-relative links (e.g. /quickstart) for internal navigation - do NOT include /docs prefix.
> Plugin development: consult /developer/plugin-types/ pages for correct interfaces and manifests.

# Core Concepts - How OwnPay Payment Architecture Works

> Overview of OwnPay's core concepts including brands, payment flow, gateways, ledger, plugins, and custom domains that power the platform.

How does OwnPay isolate multiple brands on a single server? How does a payment travel from your app to a gateway and back? This section explains OwnPay's design so you can build effectively on top of it.

<Info>
  This section is for developers and technical evaluators who want to understand how OwnPay works internally. For task-oriented guides, see the [User Guide](/user-guide/dashboard).
</Info>

## Core concept guides

Browse these guides to understand how data is managed, how payments are routed, and how isolation is enforced.

<CardGroup cols={2}>
  <Card title="Brands & Stores" href="/concepts/brands">
    How OwnPay isolates stores, credentials, ledgers, and custom domains using tenant scoping.
  </Card>

  <Card title="Payment Flow" href="/concepts/payment-flow">
    The life cycle of a transaction, from creating payment intents via API to customer redirection, verification, and settlement.
  </Card>

  <Card title="Gateways & Routing" href="/concepts/gateways">
    Understanding global gateway adapters, manual offline methods, fee rules, and currency conversion logic.
  </Card>

  <Card title="Webhooks & Events" href="/api/webhooks">
    How outbound event notifications are generated, signed (HMAC-SHA256), delivered, and retried.
  </Card>

  <Card title="User Roles & Permissions" href="/user-guide/people/roles">
    System super-administrators vs. brand-scoped staff, and mapping RBAC permissions.
  </Card>
</CardGroup>

## Architecture overview

At its core, OwnPay acts as an orchestrator sitting between your online application (merchant store) and payment networks (gateways).

```text theme={null}
┌─────────────────┐
│ Merchant App    │ (WooCommerce, SDKs, etc.)
└────────┬────────┘
         │
         │ REST API (Bearer Token)
         ▼
┌────────────────────────────────────────────────────────┐
│ OwnPay Core                                            │
│                                                        │
│  - Brand Isolation (tenant scoped DB queries)          │
│  - Double-Entry Ledger (bcmath money precision)        │
│  - Event Hook Pipeline (EventManager)                  │
└────────┬───────────────────────────────────────┬───────┘
         │                                       │
         │ Adapter Interface                     │ Adapter Interface
         ▼                                       ▼
┌─────────────────┐                     ┌─────────────────┐
│ Gateway Adapter │                     │ Gateway Adapter │
│ (e.g. Stripe)   │                     │ (e.g. bKash)    │
└────────┬────────┘                     └────────┬────────┘
         │                                       │
         ▼ API / Redirect                        ▼ API / Redirect
┌─────────────────┐                     ┌─────────────────┐
│ Stripe API      │                     │ bKash API       │
└─────────────────┘                     └─────────────────┘
```

Every database operation inside the core checks the active `merchant_id` to ensure strict tenant boundary safety.

## See also

* [Local Setup Guide](/resources/local-setup) - Ready to deploy?
* [Architecture Overview](/resources/architecture) - Developer details
* [Troubleshooting Guide](/advanced-topics/troubleshooting) - Having issues?


## Related topics

- [Core Concepts - How OwnPay Payment Architecture Works](/docs/concepts/index.md)
- [OwnPay Architecture: PHP Core, Middleware, and Plugins](/docs/resources/architecture.md)
- [Plugin System - WordPress-Style Plugin Architecture](/docs/concepts/plugins.md)
- [OwnPay API Overview - REST API for Multi-Brand Payments](/docs/api/overview.md)
- [OwnPay Skills for AI Agents - Platform Knowledge Pack](/docs/developer/ai-skills.md)
