{"openapi":"3.1.0","info":{"title":"ChainPesa API","version":"1.0.0","description":"Accept stablecoins, settle in local currency, send payouts."},"servers":[{"url":"https://dev.chainpesa.com"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"security":[{"bearer":[]}],"paths":{"/api/v1/balance":{"get":{"operationId":"balance","tags":["Balance"],"summary":"Retrieve your balance","description":"The wallet balance for each stablecoin you hold. Amounts are strings in major units with 6 decimals. A currency you have never held is not listed.","x-scope":"wallet:read","parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"object":"balance","mode":"test","available":[{"currency":"USDT","amount":"1250.000000"}]}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the wallet:read scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}},"/api/v1/payments":{"post":{"operationId":"payments-create","tags":["Payments"],"summary":"Create a payment","description":"Creates a hosted checkout with its own deposit address. Send either `amount` (a fixed stablecoin amount) or `price` (a local-currency price). \n\nWith `price`, the customer pays the stablecoin equivalent at a rate locked for 30 minutes, fees are included so you receive the full price, and you are settled in that currency.","x-scope":"payments:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Makes retries safe.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","description":"Stablecoin amount to collect, between 1 and 1,000,000. Send this or `price`, never both."},"price":{"type":"object","description":"A local-currency price. Send this or `amount`.","properties":{"amount":{"type":"string","description":"The price in major units, for example `\"1500.00\"`."},"currency":{"type":"string","description":"A local currency you have linked in Settlements, for example `NGN`."}}},"currency":{"type":"string","description":"The stablecoin the customer pays with: `USDT` or `USDC`."},"network":{"type":"string","description":"`TRON`, `BSC` or `ETHEREUM`."},"settle_to":{"type":"string","description":"With `amount`, convert what you receive into this linked local currency. Leave out to keep it in USD."},"reference":{"type":"string","description":"Your own order reference, up to 100 characters. It is returned on the payment and its webhooks."}},"required":["currency","network"]},"example":{"amount":"250.00","currency":"USDT","network":"TRON","reference":"order_1042"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"example":{"id":"pay_Qm3x9Tq1LbZa","object":"payment","status":"pending","mode":"test","amount":"250.000000","paid_amount":"0.000000","currency":"USDT","network":"TRON","address":"TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE","settle_to":null,"reference":"order_1042","price":null,"checkout_url":"https://dev.chainpesa.com/pay/pay_Qm3x9Tq1LbZa","expires_at":"2027-01-12T10:45:00.000Z","created_at":"2027-01-12T09:45:00.000Z"}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payments:write scope."},"429":{"description":"Rate limit reached. See Retry-After."}}},"get":{"operationId":"payments-list","tags":["Payments"],"summary":"List payments","description":"Your 50 most recent payments, newest first.","x-scope":"payments:read","parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"object":"list","data":[{"id":"pay_Qm3x9Tq1LbZa","object":"payment","status":"pending","mode":"test","amount":"250.000000","paid_amount":"0.000000","currency":"USDT","network":"TRON","address":"TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE","settle_to":null,"reference":"order_1042","price":null,"checkout_url":"https://dev.chainpesa.com/pay/pay_Qm3x9Tq1LbZa","expires_at":"2027-01-12T10:45:00.000Z","created_at":"2027-01-12T09:45:00.000Z"}]}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payments:read scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}},"/api/v1/payments/{id}":{"get":{"operationId":"payments-get","tags":["Payments"],"summary":"Retrieve a payment","description":"Fetch one payment. `status` is `pending`, `underpaid`, `completed` or `expired`.","x-scope":"payments:read","parameters":[{"name":"id","in":"path","required":true,"description":"The payment id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"pay_Qm3x9Tq1LbZa","object":"payment","status":"pending","mode":"test","amount":"250.000000","paid_amount":"0.000000","currency":"USDT","network":"TRON","address":"TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE","settle_to":null,"reference":"order_1042","price":null,"checkout_url":"https://dev.chainpesa.com/pay/pay_Qm3x9Tq1LbZa","expires_at":"2027-01-12T10:45:00.000Z","created_at":"2027-01-12T09:45:00.000Z"}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payments:read scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}},"/api/v1/payouts":{"post":{"operationId":"payouts-create","tags":["Payouts"],"summary":"Create a payout","description":"Sends local currency to a bank or mobile-money account. \n\nWith `funding: \"float\"` it is paid from your USD balance. With `funding: \"connector\"` (Stable Connector) no balance is used: the response includes a `funding_payment` your customer pays, and the payout is released once it is covered. \n\nPayouts of $1,000 or more wait for a second approver in the dashboard. \n\nPayouts through our payment partners are confirmed by the provider: the payout can stay `processing`, with your money held, until it becomes `completed` or `failed` (and your money is returned). Some routes take whole amounts only, with no cents. `transfer_fee` is what the local network charges for the transfer, in the payout currency: the recipient still receives `amount`, and `usd_debit` includes the fee.","x-scope":"payouts:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Makes retries safe.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","description":"Amount in local currency, major units, for example `\"50000\"`."},"currency":{"type":"string","description":"`NGN`, `KES`, `GHS`, `UGX`, `TZS`, `XOF`, `XAF` or `CNY`."},"beneficiary":{"type":"object","description":"Who is being paid.","properties":{"name":{"type":"string","description":"Account holder name, 2 to 100 characters."},"account_number":{"type":"string","description":"Bank account or mobile-money number."},"bank_id":{"type":"integer","description":"The bank or network id from [List banks](/docs/api/banks). The most reliable way to name a destination."},"bank_code":{"type":"string","description":"Bank code, used when there is no `bank_id`."},"bank_name":{"type":"string","description":"Bank or network name, used when it matches exactly one option."},"country":{"type":"string","description":"Required for `XOF`: `CI`, `SN` or `BJ`."},"network":{"type":"string","description":"With Stable Connector, the chain your customer funds on: `TRON` (default), `BSC` or `ETHEREUM`."}},"required":["name","account_number"]},"funding":{"type":"string","description":"`float` (default) or `connector`."},"reference":{"type":"string","description":"Your own reference, up to 100 characters."}},"required":["amount","currency","beneficiary"]},"example":{"amount":"50000","currency":"NGN","beneficiary":{"name":"Ada Obi","account_number":"0123456789","bank_code":"058"},"funding":"float","reference":"payout_77"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"example":{"id":"po_7Hc2kLm9PqRs","object":"payout","status":"completed","mode":"test","funding":"float","route":"psp","currency":"NGN","amount":"50000.00","transfer_fee":"0.00","usd_debit":"32.594734","rate":"1557","reference":"payout_77","failure":null,"confirmation_url":null,"created_at":"2027-01-12T09:45:00.000Z"}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payouts:write scope."},"429":{"description":"Rate limit reached. See Retry-After."}}},"get":{"operationId":"payouts-list","tags":["Payouts"],"summary":"List payouts","description":"Your 50 most recent payouts, newest first.","x-scope":"payouts:write","parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"object":"list","data":[{"id":"po_7Hc2kLm9PqRs","object":"payout","status":"completed","mode":"test","funding":"float","route":"psp","currency":"NGN","amount":"50000.00","transfer_fee":"0.00","usd_debit":"32.594734","rate":"1557","reference":"payout_77","failure":null,"confirmation_url":null,"created_at":"2027-01-12T09:45:00.000Z"}]}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payouts:write scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}},"/api/v1/payouts/{id}":{"get":{"operationId":"payouts-get","tags":["Payouts"],"summary":"Retrieve a payout","description":"`status` is `pending_funding`, `pending_approval`, `processing`, `completed`, `failed` or `cancelled`. When it is `failed`, `failure` says why.","x-scope":"payouts:write","parameters":[{"name":"id","in":"path","required":true,"description":"The payout id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"po_7Hc2kLm9PqRs","object":"payout","status":"completed","mode":"test","funding":"float","route":"psp","currency":"NGN","amount":"50000.00","transfer_fee":"0.00","usd_debit":"32.594734","rate":"1557","reference":"payout_77","failure":null,"confirmation_url":null,"created_at":"2027-01-12T09:45:00.000Z"}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payouts:write scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}},"/api/v1/banks/{currency}":{"get":{"operationId":"banks","tags":["Banks and accounts"],"summary":"List banks","description":"The banks and mobile-money networks a payout in this currency can go to. Use an `id` as `beneficiary.bank_id`.","x-scope":"payouts:write","parameters":[{"name":"currency","in":"path","required":true,"description":"A local currency, for example `GHS`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"object":"list","currency":"GHS","data":[{"id":277,"name":"MTN Ghana"}]}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payouts:write scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}},"/api/v1/accounts/verify":{"post":{"operationId":"accounts-verify","tags":["Banks and accounts"],"summary":"Verify an account","description":"Check an account before paying it and get back the name the bank holds. Available for NGN, GHS and XOF (Benin). Limited to 30 checks a minute.","x-scope":"payouts:write","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","description":"The account's currency."},"bank_id":{"type":"integer","description":"From [List banks](/docs/api/banks)."},"account_number":{"type":"string","description":"The account to check."}},"required":["currency","bank_id","account_number"]},"example":{"currency":"NGN","bank_id":1,"account_number":"0123456789"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"object":"account_verification","currency":"NGN","account_number":"0123456789","account_name":"Ada Obi"}}}},"401":{"description":"Missing, invalid or revoked API key."},"403":{"description":"The key lacks the payouts:write scope."},"429":{"description":"Rate limit reached. See Retry-After."}}}}}}