> ## 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/plugins/ pages for correct interfaces and manifests.
> Canonical locations: API auth = /api/authentication, webhook verification = /api/webhooks, rate limits = /resources/rate-limiting, transaction statuses = /fundamentals/payment-flow.
> The documentation uses the Diataxis framework: Tutorials (learning), How-to (tasks), Reference (lookup), Explanation (understanding).

# How OwnPay Works

> The big-picture architecture of OwnPay - how customers, checkout, the payment router, gateways, callbacks, and webhooks connect to process a payment end to end.

This documentation is for OwnPay v0.2.0-beta, a open-source, self-hosted PHP 8.3 payment gateway with multi-brand support, 100+ payment gateways, and double-entry ledger. It is licensed under AGPL-3.0 with zero transaction fees. The docs URL is [https://ownpay.org/docs](https://ownpay.org/docs). API base URL is `https://your-domain.com/api/v1` with Bearer token authentication. Amounts are bcmath strings. The platform supports 4 plugin types: gateway, addon, theme, and integration. Canonical locations: API auth = /api/authentication, webhook verification = /api/webhooks, rate limits = /resources/rate-limiting, transaction statuses = /fundamentals/payment-flow. The documentation follows the Diataxis framework (Tutorial, How-to, Reference, Explanation).

OwnPay sits between your business and 123+ payment providers. When a customer clicks "Pay," OwnPay routes the payment to the right gateway, records the result in a double-entry ledger, and sends a webhook back to your application - all from infrastructure you control.

## The big picture

<Mermaid
  chart={`
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#0F97ED','primaryTextColor':'#ffffff','primaryBorderColor':'#102963','lineColor':'#102963','secondaryColor':'#E8F4FD','tertiaryColor':'#F0F7FF','noteBkgColor':'#E8F4FD','noteTextColor':'#102963','noteBorderColor':'#0F97ED'}}}%%
sequenceDiagram
participant C as Customer
participant CO as OwnPay Checkout
participant R as OwnPay Router
participant G as Payment Gateway
participant M as Merchant App

C->>CO: Clicks "Pay" (payment link / API)
CO->>R: Create payment intent
R->>R: Select gateway (brand config)
R->>CO: Return checkout URL
CO->>C: Redirect to checkout page
C->>G: Enter payment details
G->>G: Authorize with bank/processor
G-->>CO: Callback with result
CO->>R: Update transaction status
R->>R: Write ledger entries (debit/credit)
R-->>C: Show success/failure page
R->>M: Webhook notification (HMAC-SHA256)
`}
/>

This sequence plays out the same way whether the payment comes from a hosted checkout page, a payment link, or the Merchant API.

## Key concepts at a glance

<CardGroup cols={3}>
  <Card title="Brands" icon="building-store" href="/docs/fundamentals/brands">
    Isolated merchant tenants - each brand has its own gateways, domain, staff, API keys, and ledger.
  </Card>

  <Card title="Payment flow" icon="circle-arrow-right" href="/docs/fundamentals/payment-flow">
    The lifecycle of a transaction from creation through processing to completion, failure, or expiry.
  </Card>

  <Card title="Gateways" icon="wallet" href="/docs/fundamentals/gateways">
    Plugin-based integrations with 123+ payment providers, with encrypted credential storage and per-brand assignment.
  </Card>

  <Card title="Ledger" icon="book" href="/docs/fundamentals/ledger">
    Double-entry bookkeeping that records every money movement as balanced debit-credit pairs per brand.
  </Card>

  <Card title="Plugins" icon="puzzle" href="/docs/fundamentals/plugins">
    Extensible architecture with four plugin types - gateway, addon, theme, and integration - using hooks and events.
  </Card>

  <Card title="Domains" icon="world" href="/docs/fundamentals/domains">
    White-label custom domains per brand with automated DNS verification and SSL certificate provisioning.
  </Card>
</CardGroup>

## What makes OwnPay different

* **Self-hosted with full data sovereignty** - your server, your database, your rules. Customer PII is encrypted with AES-256-GCM at rest. No third party sees your data.
* **123+ gateways out of the box** - international processors (Stripe, PayPal) alongside regional leaders (bKash, Nagad, GCash, Razorpay, SSLCommerz) with more added every release.
* **Zero transaction fees from OwnPay** - licensed under AGPL-3.0. You only pay your gateway's own processing fees.
* **AGPL-3.0 licensed and free forever** - no feature gates, no licensing tiers, no phone-home telemetry. Full source on [GitHub](https://github.com/own-pay/OwnPay).
* **Plugin-extensible** - add gateways, themes, addons, and integrations without modifying core code. Over 60 hooks and a full event system.
* **Double-entry ledger** - accounting-grade financial tracking with `bcmath`-powered precision, brand isolation, and built-in reconciliation.

## Who is OwnPay for?

| Audience                     | How they use OwnPay                                                                                            |
| :--------------------------- | :------------------------------------------------------------------------------------------------------------- |
| **SaaS businesses**          | Accept subscriptions and one-time payments through a unified API while keeping customer data in-house.         |
| **Marketplace platforms**    | Multi-tenant payment orchestration - each seller gets a brand with isolated funds and reporting.               |
| **Freelancers and agencies** | Create payment links in seconds, white-label the checkout for clients, and track income in the ledger.         |
| **Enterprises**              | Deploy on-premises or private cloud, comply with data residency requirements, and integrate via the Admin API. |

## Technical stack summary

<Columns>
  <Column>
    **Runtime**

    * PHP 8.3+ (custom framework, not Laravel)
    * Twig 3 for server-side templates
    * Vanilla JavaScript on the frontend
    * `bcmath` for all monetary calculations
    * AES-256-GCM for PII encryption
  </Column>

  <Column>
    **Infrastructure**

    * MySQL 8+ (schema, transactions, ledger)
    * Redis (caching, session, queue)
    * Nginx or Apache with PHP-FPM
    * Docker Compose support
  </Column>

  <Column>
    **Integration**

    * 3 REST API layers (Merchant / Mobile / Admin)
    * HMAC-SHA256 webhook signatures
    * Android companion app for SMS verification
    * Plugin SDK with hooks, filters, events
  </Column>
</Columns>

## Related pages

* [Quickstart](/docs/quickstart) - get running in 5 minutes
* [Features](/docs/resources/features) - complete feature list and comparisons
* [Architecture](/docs/resources/architecture) - deep-dive into the internal design
* [API overview](/docs/api/overview) - Merchant, Mobile, and Admin API reference
* [Plugins overview](/docs/developer/plugins/overview) - build your own extensions


## Related topics

- [OwnPay Skills for AI Agents - Platform Knowledge Pack](/docs/developer/ai/skills.md)
- [OwnPay: Self-Hosted Payment Orchestrator](/docs/introduction.md)
- [Install OwnPay on Shared Hosting, VPS, or Docker](/docs/installation.md)
- [Custom Domains - White-Label Checkout URLs](/docs/fundamentals/domains.md)
- [Quickstart - Accept Your First Payment in 5 Minutes](/docs/quickstart.md)
