Authentication

Send your secret key as a bearer token. Test keys start with sk_test_. The demo key is sk_test_demo_merchant_key.

Create a payment

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.

Statuses

StatusMeaning
awaiting_authorisationWaiting for the customer to approve in their bank
authorised / executingApproved; the bank is moving the money
settledFunds have moved. Fulfil the order.
unknownOutcome unclear (e.g. provider timeout). Being resolved automatically. Do not fulfil or cancel.
failed / cancelled / expiredFinal. No money moved.

Endpoints

EndpointDescription
POST /v1/paymentsCreate a payment
GET /v1/payments/{id}Retrieve a payment
GET /v1/paymentsList; filters status, reference; cursor starting_after, limit ≤ 100
GET /v1/payments/{id}/eventsFull status history

Webhooks

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.

Errors

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_…" } }

Sandbox

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.