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

# Accept Online Payments with the Okapay Checkout API

> Create checkout sessions, redirect customers to hosted checkout, and handle payment success or failure using the Okapay API or PHP SDK.

Okapay lets you accept one-time payments globally through hosted checkout sessions. Create a session server-side, redirect your customer to the Okapay-hosted checkout page, and then verify the result — all without building or maintaining your own payment UI.

## How checkout works

1. **Create a checkout session** server-side using the Okapay API or PHP SDK.
2. **Redirect the customer** to the `checkout_url` returned in the session response.
3. **Customer pays** using their preferred method — card, wallet, crypto, or local rail.
4. **Verify the session** by polling the verify endpoint or listening for a webhook notification to confirm payment status.

## Create a checkout session

Call the sessions endpoint with your merchant ID, the amount in the smallest currency unit (e.g. cents for USD), currency, and an optional description.

> [tab] PHP SDK
>
> ```php theme={null}
> use Okapay\Client;
>
> $okapay = new Client(['secret_key' => 'sk_live_xxx']);
>
> $session = $okapay->sessions()->create($merchantId, [
>     'amount'      => 2999,          // amount in cents
>     'currency'    => 'USD',
>     'description' => 'Order #1042',
>     'source'      => 'custom_php',
> ]);
>
> $sessionId   = $session['session_id'];
> $checkoutUrl = $session['checkout_url']; // redirect your customer here
> ```

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://api.okapay.net/merchant-api/{merchant_id}/checkout-sessions \
>   -H "Authorization: Bearer sk_live_xxx" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "amount": 2999,
>     "currency": "USD",
>     "description": "Order #1042",
>     "source": "custom_php"
>   }'
> ```

## Request parameters

**amount** `integer` *required*

The payment amount in the **smallest currency unit** — for example, cents for USD. To charge \$29.99, send `2999`.

**currency** `string` *required*

ISO 4217 currency code, e.g. `USD`, `EUR`, `GBP`. Okapay supports 135+ currencies.

**description** `string`

A human-readable description of the purchase shown to the customer on the checkout page, e.g. `Order #1042`.

**source** `string`

An optional identifier for the integration source, used to tag sessions in the dashboard. For example, `custom_php`, `wordpress`, or `laravel`.

## Verify payment status

After the customer completes checkout, verify the session to confirm whether the payment succeeded.

> [tab] PHP SDK
>
> ```php theme={null}
> $status = $okapay->sessions()->verify($merchantId, $sessionId);
>
> if ($status['status'] === 'paid') {
>     // fulfil the order
> } elseif ($status['status'] === 'pending') {
>     // payment is still processing — check again shortly
> } else {
>     // payment failed — prompt the customer to retry
> }
> ```

> [tab] cURL
>
> ```bash theme={null}
> curl -X GET https://api.okapay.net/merchant-api/{merchant_id}/{session_id} \
>   -H "Authorization: Bearer sk_live_xxx"
> ```

The response includes a `status` field with one of the following values:

| Status | Meaning |
| - | - |
| `paid` | Payment completed successfully. Safe to fulfil the order. |
| `pending` | Payment is still processing. Poll again after a short delay. |
| `failed` | Payment was not completed. Prompt the customer to retry. |

## Supported payment methods

Okapay automatically shows all available payment methods at checkout based on your customer's location and device.

**Credit & Debit Cards**

* Visa
* Mastercard
* American Express
* JCB
* Discover
* Diners Club
* Maestro

**Digital Wallets**

* Google Pay
* Apple Pay
* Revolut Pay

**Cryptocurrencies**

* Bitcoin (BTC)
* Ethereum (ETH)
* Solana (SOL)
* Tether (USDT)
* USD Coin (USDC)
* TRON (TRX)
* BNB Chain (BNB)

**Local Rails**

* PIX — Brazil instant bank transfer

**Buy Now, Pay Later**

* Klarna BNPL — available in Europe and the US

> [!TIP]
>
> Use webhooks for automated, real-time payment notifications instead of polling the verify endpoint. Webhooks fire the moment a payment status changes, making them the recommended approach for production fulfilment flows. Configure your webhook endpoint from **Settings → Webhooks** in the dashboard.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.