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

# OwnPay API Overview - REST API for Multi-Brand Payments

> Introduction to OwnPay REST APIs covering base URLs per brand and master domain, authentication, rate limits, and available endpoint groups.

OwnPay provides a REST API for programmatic access to payments, transactions, and webhooks. This page covers authentication, endpoints, and quick examples.

## Base URL

```text theme={null}
https://yourdomain.com/api/v1
```

## Authentication

All API requests require a Bearer token in the Authorization header:

```bash theme={null}
curl -H "Authorization: Bearer op_live_your_api_key" \
     https://yourdomain.com/api/v1/payments
```

See [Authentication](/api/authentication) for key management and security best practices.

## Create a payment

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://yourdomain.com/api/v1/payments \
    -H "Authorization: Bearer op_live_your_key" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 5000,
      "currency": "USD",
      "customer_email": "customer@example.com",
      "description": "Order #123"
    }'
  ```

  ```php PHP theme={null}
  $client = new \OwnPay\SDK\Client(
      publicKey: $_ENV['OWNPAY_PUBLIC_KEY'],
      secretKey: $_ENV['OWNPAY_SECRET_KEY'],
      baseUrl: 'https://yourdomain.com/api/v1'
  );

  $payment = $client->payments()->create([
      'amount' => 5000,
      'currency' => 'USD',
      'customer_email' => 'customer@example.com',
      'description' => 'Order #123'
  ]);
  ```

  ```javascript Node.js theme={null}
  import OwnPay from 'ownpay';

  const ownpay = new OwnPay({
    publicKey: process.env.OWNPAY_PUBLIC_KEY,
    secretKey: process.env.OWNPAY_SECRET_KEY,
    baseUrl: 'https://yourdomain.com/api/v1'
  });

  const payment = await ownpay.payments.create({
    amount: 5000,
    currency: 'USD',
    customer_email: 'customer@example.com',
    description: 'Order #123'
  });
  ```
</CodeGroup>

## Response format

```json theme={null}
{
  "success": true,
  "data": {
    "id": "pay_abc123...",
    "amount": 5000,
    "currency": "USD",
    "status": "pending",
    "checkout_url": "https://yourdomain.com/checkout/pay_abc123",
    "customer_email": "customer@example.com"
  }
}
```

The `checkout_url` is where your customer completes the payment.

## Core endpoints

### Payments

| Endpoint         | Method | Description             |
| ---------------- | ------ | ----------------------- |
| `/payments`      | POST   | Create a payment        |
| `/payments/{id}` | GET    | Get payment details     |
| `/payments/{id}` | PATCH  | Update payment metadata |

### Transactions

| Endpoint             | Method | Description             |
| -------------------- | ------ | ----------------------- |
| `/transactions`      | GET    | List transactions       |
| `/transactions/{id}` | GET    | Get transaction details |

### Payment Links

| Endpoint              | Method | Description              |
| --------------------- | ------ | ------------------------ |
| `/payment-links`      | POST   | Create a payment link    |
| `/payment-links`      | GET    | List payment links       |
| `/payment-links/{id}` | GET    | Get payment link details |

### Customers

| Endpoint          | Method | Description          |
| ----------------- | ------ | -------------------- |
| `/customers`      | GET    | List customers       |
| `/customers/{id}` | GET    | Get customer details |

## Webhooks

Receive real-time notifications when payment events occur. See [Webhooks](/api/webhooks) for setup and signature verification.

```json theme={null}
{
  "event": "payment.paid",
  "data": {
    "id": "pay_abc123",
    "amount": 5000,
    "currency": "USD",
    "status": "paid"
  }
}
```

## Rate limiting

| Tier     | Requests/minute |
| -------- | --------------- |
| Standard | 60              |
| Premium  | 300             |

Rate limit headers:

```http theme={null}
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1718000060
```

## Error handling

All errors return a consistent JSON structure:

```json theme={null}
{
  "success": false,
  "error": {
    "code": "invalid_amount",
    "message": "Amount must be greater than 0"
  }
}
```

See [Error codes](/api/errors) for the full reference.

## SDKs

<CardGroup cols={3}>
  <Card title="PHP SDK" icon="code" href="/developer/integration/php">
    `composer require ownpay/php-sdk`
  </Card>

  <Card title="Laravel SDK" icon="laravel" href="/developer/integration/laravel">
    `composer require ownpay/ownpay-laravel`
  </Card>

  <Card title="Node.js SDK" icon="brackets" href="/developer/integration/nodejs">
    `npm install ownpay-nodejs`
  </Card>
</CardGroup>


## Related topics

- [Developer Quickstart - Build Your First Payment Integration](/docs/developer/quickstart.md)
- [Node.js SDK - TypeScript-First Payment Integration](/docs/developer/integration/nodejs.md)
- [Retrieve Payment Details](/docs/api-reference/retrieve-payment-details.md)
- [Initiate Payment Intent](/docs/api-reference/initiate-payment-intent.md)
- [Retrieve Transaction](/docs/api-reference/retrieve-transaction.md)
