Send your secret key as a bearer token. Test keys start with sk_test_. The demo key is sk_test_demo_merchant_key.
Amounts are integers in minor units (1250 = £12.50). Idempotency-Key is required.
curl -X POST http://localhost:5173/v1/payments \
-H "Authorization: Bearer sk_test_demo_merchant_key" \
-H "Idempotency-Key: order-1001" \
-H "Content-Type: application/json" \
-d '{"amount":1250,"currency":"GBP","reference":"ORDER-1001","return_url":"https://shop.example/thanks"}'Redirect your customer to payment_url. Same key + same body returns the original payment; same key + different body returns 409 idempotency_conflict.
| Status | Meaning |
|---|---|
awaiting_authorisation | Waiting for the customer to approve in their bank |
authorised / executing | Approved; the bank is moving the money |
settled | Funds have moved. Fulfil the order. |
unknown | Outcome unclear (e.g. provider timeout). Being resolved automatically. Do not fulfil or cancel. |
failed / cancelled / expired | Final. No money moved. |
| Endpoint | Description |
|---|---|
POST /v1/payments | Create a payment |
GET /v1/payments/{id} | Retrieve a payment |
GET /v1/payments | List; filters status, reference; cursor starting_after, limit ≤ 100 |
GET /v1/payments/{id}/events | Full status history |
Events: payment.authorised, payment.executing, payment.settled, payment.failed, payment.cancelled, payment.expired. Delivered at least once with retries and backoff.
Verify Gateway-Signature: t=<unix>,v1=<hex> where v1 = HMAC_SHA256(secret, t + "." + rawBody). Reject timestamps older than 5 minutes, dedupe on Gateway-Event-Id, and ignore events with a lower data.version than you have stored.
Every error has the same shape and every response carries X-Request-Id.
{ "error": { "type": "invalid_request_error", "code": "invalid_amount",
"message": "amount must be a positive integer in minor units", "param": "amount", "request_id": "req_…" } }Add "sandbox": {"scenario": "initiation_timeout" | "provider_error" | "reject"} to simulate provider failures. On the Sandbank approval screen you can trigger duplicate, out-of-order or missing webhooks.