> ## 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).

# Plugin System - Extensible Architecture

> OwnPay's plugin architecture supports four types - gateway, addon, theme, and integration - using a manifest-based discovery system with hooks, filters, and a capabilities model.

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's core handles routing, the ledger, brands, and the checkout framework. Everything else - payment providers, custom themes, extra features, and third-party integrations - is delivered through **plugins**. This means you can extend OwnPay without modifying a single line of core code.

## Four plugin types

<CardGroup cols={2}>
  <Card title="Gateway" icon="wallet">
    Add a new payment provider. Each gateway plugin implements the payment adapter contract: process payments, handle callbacks, manage refunds, and declare supported currencies. Examples: Stripe, bKash, Razorpay.
  </Card>

  <Card title="Addon" icon="circle-plus">
    Add features to the admin panel or checkout. Addons can register admin pages, API endpoints, scheduled jobs, and UI components. Examples: subscription management, CRM sync, advanced reporting.
  </Card>

  <Card title="Theme" icon="palette">
    Customize the checkout experience. Theme plugins provide Twig templates, CSS, JavaScript, and asset files that override the default checkout appearance per brand.
  </Card>

  <Card title="Integration" icon="plug">
    Connect OwnPay to external platforms. Integration plugins handle OAuth flows, data syncing, and webhook translation for WooCommerce, WHMCS, Laravel, and other frameworks.
  </Card>
</CardGroup>

## Manifest-based discovery

Every plugin lives in the `modules/` directory and declares itself through a `manifest.json` file. OwnPay's plugin loader scans this directory at boot time, reads each manifest, validates the structure, and registers the plugin with the PSR-4 autoloader.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "slug": "stripe",
  "name": "Stripe Payment Gateway",
  "version": "1.0.0",
  "type": "gateway",
  "entrypoint": "src/StripeGateway.php",
  "namespace": "OwnPay\\Gateways\\Stripe"
}
```

<Tree />

## Hook system

Plugins interact with OwnPay and with each other through two mechanisms:

**Filters** modify data before an action runs:

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
// A plugin adjusts the payment amount
$amount = Hook::apply('payment.amount', $amount, $payment);
```

**Actions** react to events after they occur:

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
// A plugin sends a Slack notification after payment completes
Hook::do('payment.completed', $payment);
```

OwnPay exposes over 60 hooks across categories like `payment.*`, `customer.*`, `gateway.*`, `webhook.*`, and `system.*`.

## Capabilities system

Plugins declare what they need through a **capabilities** array in their manifest. OwnPay checks these capabilities before loading the plugin. This lets the system warn administrators about missing dependencies before activation.

Common capabilities: `payment_processing`, `admin_ui`, `cron_jobs`, `webhook_handler`, `api_endpoints`.

## Plugin sandbox

OwnPay restricts plugin upload to the platform owner (master administrator). A **footgun scanner** runs on upload and blocks dangerous functions like `eval()` and direct OS command execution. Standard PHP operations - reflection, callbacks, file I/O - are permitted.

<Note>
  The security boundary is **owner-only upload**, not in-process isolation. Plugins run with full application trust, similar to the WordPress plugin model. Only install plugins from sources you trust.
</Note>

## Related pages

* [Plugin overview (developer)](/docs/developer/plugins/overview) - build and register your first plugin
* [Hooks reference](/docs/developer/plugins/hooks) - complete list of available filters and actions
* [Events reference](/docs/developer/plugins/events) - event categories and listener registration
* [Capabilities](/docs/developer/plugins/capabilities) - declare and check plugin capabilities
* [Build a gateway plugin](/docs/developer/plugin-types/gateway) - step-by-step gateway development guide


## Related topics

- [Plugin System](/docs/developer/plugins/overview.md)
- [How OwnPay Works](/docs/fundamentals/how-ownpay-works.md)
- [OwnPay Architecture: PHP Core, Middleware, and Plugins](/docs/resources/architecture.md)
- [OwnPay Skills for AI Agents - Platform Knowledge Pack](/docs/developer/ai/skills.md)
- [OwnPay: Self-Hosted Payment Orchestrator](/docs/introduction.md)
