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

# Payment Flow - End-to-End Transaction Lifecycle

> End-to-end life cycle of a payment from intent creation, gateway redirect, callback handling, SMS verification, settlement, and webhook delivery.

What happens between when a customer clicks "Pay" and when funds appear in your ledger? This page traces the journey of a payment through OwnPay, including the states it passes through and the events it triggers.

<Info>
  To accept your first payment right now, follow the [Developer Quickstart](/developer/quickstart) instead.
</Info>

## How a payment flows through OwnPay

```text theme={null}
Customer         OwnPay           Gateway          Customer
                                                   Bank
   │                │                │               │
   │─ Click "Pay" ─>│                │               │
   │                │                │               │
   │                │─ Create Payment│               │
   │                │    Intent      │               │
   │                │<─ Return URL ──│               │
   │                │                │               │
   │<─ Redirect to ─│                │               │
   │   Checkout     │                │               │
   │                │                │               │
   │─ Enter Card ──>│                │               │
   │                │─ Validate ────>│               │
   │                │                │─ Check ──────>│
   │                │                │<─ Approve ────│
   │                │<─ Success ─────│               │
   │<─ Success Page │                │               │
   │                │─ Record Payment│               │
   │                │   in Database  │               │
   │                │                │               │
   │                │─ Send Webhook ─>
   │                │   (if registered)
   │                │                │               │
   │<─ Confirmation │                │               │
   │   Email        │                │               │
```

## Payment States

Every payment goes through these states:

### 1. **Pending**

* Payment created
* Awaiting customer action
* Link sent or form displayed
* No funds charged yet

### 2. **Processing**

* Customer submitting payment
* Gateway validating
* No result yet from gateway
* Customer sees loading spinner

### 3. **Success**

* Gateway approved payment
* Funds authorized
* Transaction recorded
* Webhook sent (if configured)
* Customer sees success page

### 4. **Failed**

* Gateway declined payment
* Could be:
  * Insufficient funds
  * Invalid card
  * Fraud detection
  * Temporary network error
* Webhook sent (if configured)
* Customer can retry

### 5. **Refunded**

* Payment was successful
* Funds returned to customer
* Initiated by merchant
* Recorded in transaction history

### 6. **Disputed/Chargeback**

* Customer disputed payment
* Gateway initiated reversal
* Funds returned
* Recorded as chargeback

## Payment Methods

OwnPay supports multiple payment methods:

### Card Payments

* **Credit Cards** (Visa, Mastercard, AmEx)
* **Debit Cards**
* **Processed by payment gateway** (Stripe, PayPal, etc.)

### Digital Wallets

* **Apple Pay**
* **Google Pay**
* **PayPal**

### Local Payment Methods

* **Bank Transfer**
* **Mobile Money** (bKash, Nagad, GCash, etc.)
* **Cash on Delivery**
* **Manual Invoice**

### Bank-Level Integration

* **ACH Transfers** (US)
* **SEPA Transfers** (EU)
* **Direct Debit**

## Payment Creation

### Via Payment Link

1. Admin creates payment link
2. System generates unique URL
3. Customer visits URL
4. Checkout form displayed
5. Customer enters payment details
6. Payment processed

### Via Invoice

1. Admin creates invoice
2. System sends invoice via email
3. Customer clicks payment link
4. Checkout form displayed
5. Customer enters payment details
6. Payment processed

### Via API

1. Application creates payment intent
2. OwnPay returns checkout URL or token
3. Application displays payment form
4. Customer enters payment details
5. Payment processed
6. Webhook notifies application

### Via Hosted Checkout

1. Application redirects to OwnPay
2. Customer completes payment on OwnPay-hosted page
3. OwnPay redirects customer back to application
4. Webhook notifies application of result

## Payment Processing Times

| Payment Method    | Processing Time     |
| ----------------- | ------------------- |
| Credit/Debit Card | Instant             |
| Digital Wallets   | Instant             |
| Bank Transfer     | 1-3 business days   |
| Mobile Money      | Instant to minutes  |
| Manual Invoice    | Manual confirmation |

## Security

* All payment data is encrypted in transit (TLS 1.2+)
* PCI DSS compliant gateway integration
* No sensitive card data stored on OwnPay servers
* Webhook signatures for verification
* Idempotency keys prevent duplicate charges

## Further reading

* [Transactions](/user-guide/payments/transactions) - View and filter transaction history in the admin dashboard
* [Webhooks](/api/webhooks) - Receive real-time payment notifications on your server
* [Gateways](/concepts/gateways) - Configure payment gateway adapters and routing rules

## Related Pages

* [Gateways](/concepts/gateways) - Configure payment gateways
* [Transactions](/user-guide/payments/transactions) - View transaction history
* [Webhooks](/api/webhooks) - Receive payment notifications


## Related topics

- [Developer Quickstart - Build Your First Payment Integration](/docs/developer/quickstart.md)
- [List Refunds](/docs/api-reference/list-refunds.md)
- [OwnPay Architecture: PHP Core, Middleware, and Plugins](/docs/resources/architecture.md)
- [Node.js SDK - TypeScript-First Payment Integration](/docs/developer/integration/nodejs.md)
- [Transactions - View Payments, Refunds, and Gateway Status](/docs/user-guide/payments/transactions.md)
