Skip to content
ChainPesaDocsTest mode
Dashboard

Get started

Idempotent requests

Retry safely: the same key never creates a second payment or payout.

Send an Idempotency-Key header, up to 120 characters, when you create a payment or payout. If a request with that key already succeeded, you get the original object back and nothing new is created.

curl -X POST https://dev.chainpesa.com/api/v1/payouts \
  -H "Authorization: Bearer $CHAINPESA_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "50000",
    "currency": "NGN",
    "beneficiary": {
      "name": "Ada Obi",
      "account_number": "0123456789",
      "bank_code": "058"
    },
    "funding": "float",
    "reference": "payout_77"
  }'
  • Use a fresh random value, such as a UUID, for each new operation.
  • Store it with your order before you send the request, so a retry after a crash uses the same one.
  • A reused key returns the first object even if you send a different body. Never reuse a key for a different operation.

A network timeout does not mean the request failed. Retry with the same key to find out.