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

# Payment links

> Hosted checkout pages you can share, and checkout sessions for when a payment has to match one of your orders.

A payment link is a checkout page hosted by Kori at `https://pay.kori.ml/<slug>`. The
customer opens it, enters their mobile-money number, approves the prompt on their phone,
and your balance is credited. No integration is needed on your side to take a payment.

There are two ways to use one:

| | Bare link | Checkout session |
| - | - | - |
| URL | `pay.kori.ml/<slug>` | `pay.kori.ml/s/ps_…` |
| Who can pay | Anyone with the link, as many times as the link allows | One payer, once |
| Amount | The link's, or the payer types it | Fixed by you, per session (or the link's) |
| Your order reference | Only as an editable URL parameter | Stored by Kori; the payer cannot change it |
| Created by | You, once | Your server, per order |
| Good for | Donations, tips, a poster, a price list | Orders, invoices, anything you fulfil |

## Bare links

Create the link once and share its `full_url`:

```bash theme={null}
curl -X POST https://gateway.kori.ml/merchant/api/payment-links \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Abonnement mensuel",
    "amount": 15000,
    "url_slug": "abonnement",
    "usage_limit": 100
  }'
```

* Omit `amount` for an **open-amount** link; the payer types the amount (minimum 100 XOF).
* `url_slug` is optional. When you set it: 3–100 characters, lowercase letters, digits and
  hyphens. Omit it and one is generated from the title.
* `usage_limit` caps the number of successful payments. A payment still awaiting the
  payer's confirmation holds a place for up to 10 minutes, so people paying at the same
  moment cannot push the link past its limit.
* `expires_at` closes the link at a given time.

When a payment on a link is confirmed you receive the
[`payment_link_used`](https://docs.kori.ml/en/webhooks#event-payloads) webhook.

### URL parameters

A bare link also accepts `?amount=` (open-amount links only), `?returnUrl=` and
`?client_reference_id=`:

```
https://pay.kori.ml/abonnement?client_reference_id=order_1042&returnUrl=https://shop.example/thanks
```

> [!WARNING]
>
> These parameters travel in a URL the payer can **edit**. A payer can change
> `client_reference_id` to someone else's order, or pay a different amount. Treat them as
> hints, never as proof. If a payment has to match one of your orders, use a checkout
> session.

## Checkout sessions

A checkout session is one payer's checkout on a link. Your server creates it with the
amount, your reference and the return URL, and Kori keeps them. The URL carries only an
unguessable token, so there is nothing in it for anyone to tamper with.

**1. Create a link once**

One link can serve all your sessions. An open-amount link lets each session carry its
own amount.

**2. Create a session per order, from your server**

```bash theme={null}
curl -X POST https://gateway.kori.ml/merchant/api/payment-links/17/sessions \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 7500,
    "client_reference_id": "order_1042",
    "return_url": "https://shop.example/orders/1042/thanks",
    "expires_in": 3600
  }'
```

```json Response theme={null}
{
  "success": true,
  "message": "Payment session created",
  "data": {
    "id": 233,
    "payment_link_id": 17,
    "url": "https://pay.kori.ml/s/ps_9f86d081884c7d659a2feaa0c55ad015",
    "amount": 7500,
    "currency": "XOF",
    "client_reference_id": "order_1042",
    "return_url": "https://shop.example/orders/1042/thanks",
    "status": "open",
    "transaction_id": null,
    "expires_at": "2026-10-22T13:00:00.000Z",
    "completed_at": null,
    "created_at": "2026-10-22T12:00:00.000Z"
  }
}
```

**3. Send the payer to data.url**

Redirect them, or send the URL by SMS or WhatsApp. The page shows the amount locked;
the payer only chooses an operator and enters their number.

**4. Fulfil on the webhook**

`payment_link_used` arrives with `payment_session_id: 233` and your
`client_reference_id`. Because both came from your server, you can match the payment
to the order directly.

> [!WARNING]
>
> Create sessions **from your server**, never from a browser or a mobile app. The call
> needs your Bearer token, and that token must never be shipped to a client.

### Fields

| Field | Required | Notes |
| - | - | - |
| `amount` | No | Open-amount links only, minimum 100 XOF. Omit it to let the payer type the amount. On a fixed-amount link, omit it or send the link's own amount. |
| `client_reference_id` | No | Up to 128 characters. Returned on the webhook. |
| `return_url` | No | Where the payer goes a few seconds after paying. Must be `https` (the sandbox also accepts `http`, for localhost). |
| `expires_in` | No | Seconds, from 300 (5 min) to 604800 (7 days). Default 86400 (24 h). Never later than the link's own `expires_at`. |

### Lifecycle

| `status` | Means |
| - | - |
| `open` | Waiting for a payment |
| `completed` | Paid. `transaction_id` and `completed_at` are set. A session never takes a second payment. |
| `canceled` | You canceled it with `POST /payment-sessions/{id}/cancel` |
| `expired` | `expires_at` passed without a payment |

A session takes **one** payment. While a payment on it awaits the payer's confirmation,
another attempt is refused for up to 10 minutes, so a double tap cannot send two prompts
for the same order. If that attempt fails, the payer can try again straight away.

Canceling stops new attempts. A payment the payer had already approved on their phone
still goes through and completes the session: that money is real, and you are credited
for it.

Check a session at any time:

```bash theme={null}
curl https://gateway.kori.ml/merchant/api/payment-sessions/233 \
  -H "Authorization: Bearer <token>"
```

> [!TIP]
>
> In the sandbox, session URLs point to `https://pay.kori.ml/test/s/…`. See
> [Sandbox](https://docs.kori.ml/en/sandbox.md).


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