Appearance
Errors
Every route answers with one envelope, on success and on failure. Branch on the HTTP status first, then on code. Never branch on description: it is written for people and can change.
json
{ "ok": true, "description": "Checkout created", "data": { "id": "cs_ke_4f1c2a9b7e0d3c5a8b6f2e1d" } }json
{ "ok": false, "description": "Missing, unknown or revoked API key", "data": {}, "code": 2781 }| Field | Type | Meaning |
|---|---|---|
ok | boolean | true on success, false on an error |
description | string | A sentence for logs and people. On some 1701 errors it names the problem, such as line_items must sum to amount or limit is 1 to 100 |
data | object | The payload on success. {} on an error, except on the refusals listed below that carry details |
code | integer | Errors only. The number to branch on |
Log code and description together for every error. Support will ask for both.
data.error: the code's name
Errors from the pocket routes also carry the code's name in data.error, beside any other data the refusal has:
json
{
"ok": false,
"description": "Your platform's MOOKHPay balance is too low for this pay-in. Top it up and try again",
"data": { "error": "PLATFORM_BALANCE_INSUFFICIENT", "available": 250000 },
"code": 3060
}data.error is on the errors the pay-in routes (/accounts/:id/transfers…) and the payout destination routes answer themselves, on 3061 from any account route, and on the pocket refusals of the payout, balance and movements routes (3037, 3063 and the errors after them). The checks every route shares never add it, even on those routes: the key, scope and platform checks (2781, 2941, 2942, 3013), the signature (3021, 3022), an unknown account (2943), a schema error (1701) and the per-minute rate limit (1804).
Branch on code. data.error names the same thing, so you can log it, or match on it if you prefer names. Do not branch on description.
Refusals that carry data
Most errors have data: {}. These carry more.
| Code | HTTP | data |
|---|---|---|
1804, 3005, 3026 | 429 | { "retryAfter": <seconds> }, the same number as the Retry-After header. A login link refused by authn-service's hourly count (3026) has no data and no header |
3002 | 409 | { "charge": "ch_ke_…" }, the charge still pending for that reference |
2947, 2948, 3062 | 422 | { "cap", "used", "remaining" }, minor units. A field the service could not read is left out |
3060 | 422 | { "error", "available" }: your main balance in minor units. available is left out if it could not be read |
3065 | 422 | { "error", "tries_left" }: wrong codes left before the code stops working |
1804 | 429 | On POST /accounts/:id/payout-destination only, for one code a minute per account: { "error", "retry_after" } in seconds. There is no Retry-After header on this one |
1701 | 400 | On the pay-in routes, { "error", "reason" }: amount must be whole currency units (a multiple of 100) or limit is 1 to 100 |
3040 | 422 | { "source": "payout_account" } or { "source": "phone" }, which of the seller's numbers the rail cannot pay |
2723, 2779 | 402, 502 | { "charge": "ch_ke_…", "failure": { "code", "message" } }, from the card element's charge route |
3031 | 409 | What the request is missing, as authn-service sends it |
3032 | 409 | { "reason", "username"? }: reason is not_allowed, required, too_many, self or duplicate |
3034 | 400 or 413 | Why the document was refused, as authn-service sends it |
2861 | 409 | { "reason" }, why the payment cannot be refunded: not_paid, nothing_left, other_refund, platform_payment, test_payment or not_inbound |
2863 | 422 | { "refundable" }, how much of the payment is left to refund, in minor units |
Validation errors do not name the field
A request that breaks the route's schema (an unknown field, a missing field, a string that is too long, a missing Idempotency-Key header) answers 400 and code 1701 with the generic description The request contains invalid data. It does not say which field. Check the request against the parameter table on the route's page.
The checks run in this order, which matters when you debug:
- A request carrying an identity header is refused first:
400,3014. - A body that is not valid JSON is refused next:
400,1701. - Then the key is checked (
401,2781) and the scope (403,2941). - Only then is the request checked against the schema:
400,1701.
So a 400 1701 about a field means the key and scope passed. A 401 does not tell you the body was valid.
HTTP status
| HTTP | Meaning | What to do |
|---|---|---|
200 | Success, or an idempotent replay of a create | Use data |
201 | Created: a checkout, charge, refund, account, link, request or document | Use data |
202 | Accepted: a payout requested, or a card or mobile-money attempt started | Wait for the webhook, or read the object |
400 | The request is invalid | Fix it. The same request fails again |
401 | The key is missing, unknown or revoked; a signed request's signature was refused; or a card element client_secret was refused | Fix the key, signature or secret |
402 | A card was declined in the card element | Let the payer try another card |
403 | A scope, a platform switch, an address or an origin is missing | See the code |
404 | Nothing by that id that your key may see, or a route switched off on this deployment | Check the id and the deployment |
409 | A conflict with the current state, including an account whose holder disconnected your platform (3061) | See the code |
413 | A body over the route's size limit | Send less |
415 | A body with a content type the route does not take, such as form-encoded instead of JSON. Code 1701. Other 4xx statuses the web framework raises come back the same way, with their own status and 1701 | Send JSON, or no body |
422 | The amount, rail, balance, a cap, or an Idempotency-Key reused with another body | See the code |
423 | The seller's wallet is locked | Wait for the lock to end |
429 | Over a rate limit | Wait Retry-After seconds, then retry |
500 | An unexpected error (1802) | Retry with the same Idempotency-Key. Report it if it repeats |
502 | The card processor did not give a usable answer | See the code |
503 | A service MOOKHPay depends on did not answer | Retry with backoff and the same Idempotency-Key |
A route that a deployment has switched off is not registered at all. It answers 404 with the web framework's own body ({ "message", "error", "statusCode" }), not the envelope. Seller accounts and payouts on a platform, pockets (pay-ins and payout destinations), login links, account links, direct charges and the card element routes are each switched on per deployment. GET /balance and GET /balance/transactions are always there.
Keys, scopes and headers
These can come from any merchant route.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 3014 | IDENTITY_HEADER_REFUSED | The request carries a session or identity header, such as X-User-ID, X-Acting-As, X-Actor-ID, X-Staff-ID, X-Session-Scope, X-Limits-Tier or X-Internal-Secret. See the full list | Remove the header. Proxies and SDKs sometimes add them |
400 | 1701 | INVALID_REQUEST_DATA | The body is not JSON, or breaks the route's schema | Fix the request |
401 | 2781 | API_KEY_INVALID | No Authorization: Bearer header, a value that is not mkp_test_ or mkp_live_ and 52 characters from A-Z and 2-7, or an unknown or revoked key, or one replaced more than 24 hours ago | Check the key. A revoked key keeps working for up to 60 seconds on most routes, then stops |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key does not carry the scope the route needs, or on_behalf_of was sent without payments:write | Issue a key with the scope. See API keys and scopes |
403 | 3042 | API_KEY_IP_NOT_ALLOWED | The account has allowed addresses and the call came from another address | Call from a listed address, or have an Owner add this one in the hub. A change takes up to 60 seconds |
429 | 1804 | RATE_LIMIT_EXCEEDED | Over a rate limit. See Limits | Wait Retry-After seconds |
500 | 1802 | INTERNAL_SERVER_ERROR | Something unexpected failed | Retry with the same Idempotency-Key. Report the time and route if it repeats |
503 | 2782 | AUTHN_UNAVAILABLE | The key could not be checked | Retry with backoff |
Hosted checkouts
POST /checkouts and GET /checkouts/:id.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; line_items must sum to amount; or a return_url that breaks the address rules (the description names the problem) | Fix the request |
404 | 2783 | CHECKOUT_NOT_FOUND | No checkout by that id, or one your key may not read | Check the id. Another merchant's checkout answers the same |
409 | 2709 | WALLET_NOT_PROVISIONED | The payee's main wallet does not exist yet. A new seller account's wallet is made just after the account | Retry after a few seconds |
422 | 2702 | INVALID_AMOUNT | amount is outside the country's mobile-money limits, or not whole units in Uganda | See Limits |
422 | 2721 | COLLECTION_DISABLED | This deployment takes no mobile-money payments | Contact MOOKHPay |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key already made a checkout from a different body. Also answered when the stored checkout for this key was made the other way (as a platform for a seller, or for yourself), which does not happen in normal use | Use a new key for the new body |
503 | 2752 | LEDGER_UNAVAILABLE | The payee's wallet could not be checked | Retry with the same Idempotency-Key |
A checkout's Idempotency-Key compares bodies: the same key and body answer the first checkout with 200, and a different body answers 3015. A checkout made before this changed in November 2026 has no stored body, and its key answers the first checkout whatever the body. See Idempotency.
Payments for a seller
POST /checkouts and POST /charges with on_behalf_of or platform_fee.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | platform_fee sent without on_behalf_of | Send both, or neither |
400 | 3017 | PLATFORM_FEE_INVALID | amount is not a multiple of 100; platform_fee is not a multiple of 100, over your platform's maximum share, or leaves the seller less than 100. The description says which | Fix the amount or fee |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key lacks payments:write | Issue a key with it |
403 | 2942 | PLATFORM_NOT_ENABLED | Your organisation is not switched on as a platform, or its platform is suspended | Contact MOOKHPay |
403 | 3013 | PLATFORM_IP_NOT_ALLOWED | Your platform has an IP allow-list and the request came from another address | Call from a listed address, or ask MOOKHPay to change the list |
404 | 2943 | PLATFORM_ACCOUNT_NOT_FOUND | on_behalf_of is malformed, unknown, another platform's or revoked | Check the id. Each miss is counted |
409 | 3018 | PLATFORM_FEE_WALLET_MISSING | A fee above 0 and your own organisation's main wallet does not exist | Finish your organisation's setup |
429 | 1804 | RATE_LIMIT_EXCEEDED | Your key sent too many unknown account ids in the hour | Stop sending unknown ids. See Limits |
503 | 2752 | LEDGER_UNAVAILABLE | Your own wallet could not be checked | Retry |
503 | 3016 | PLATFORM_ACCOUNTS_UNAVAILABLE | The account could not be read | Retry |
Direct charges
POST /charges, GET /charges/:id, GET /charges, POST /charges/:id/cancel. A payment that the payer declines is not an error: the charge is created and ends failed with a failure code.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; phone is not a number this rail can prompt; a bad payer_email; payer_email on a paybill charge; bad metadata; cancel takes no body; limit is 1 to 100 | Fix the request |
400 | 3004 | CHARGE_METHOD_UNAVAILABLE | card on an mkp_test_ key or where cards are off; paybill on a test key or where Pay Bill is off | Use another method. Card charges cannot be tested on a test key |
404 | 3001 | CHARGE_NOT_FOUND | No charge by that id that your key may see. Cancel also answers this for a charge your key did not make | Check the id |
409 | 2709 | WALLET_NOT_PROVISIONED | The payee's wallet does not exist yet | Retry after a few seconds |
409 | 2836 | CHECKOUT_TEST_MODE | A test key, and a phone that is not a test number | Use a test number |
409 | 3002 | CHARGE_REFERENCE_PENDING | A charge for this reference is still pending. data.charge names it | Wait for it to end, or cancel it, then create a new one |
409 | 3003 | CHARGE_NOT_CANCELLABLE | The charge is not pending | Read the charge. It has already ended |
422 | 2701 | RAIL_NOT_AVAILABLE | This host has no mobile-money rail, or payment_method.rail names another rail | Leave rail out, or send this host's rail |
422 | 2702 | INVALID_AMOUNT | amount is outside the rail's limits | See Limits |
422 | 2721 | COLLECTION_DISABLED | Collection is off for this rail | Contact MOOKHPay |
422 | 2838 | TEST_NUMBER_LIVE | A live key, and a test number | Use a real number |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was used with a different body | Use a new key for a new charge |
429 | 3005 | CHARGE_PROMPT_LIMIT | Too many prompts to this phone across MOOKHPay, too many to this phone from you, or too many charges from your account | Wait Retry-After seconds |
503 | 2752 | LEDGER_UNAVAILABLE | The payee's wallet could not be checked | Retry with the same Idempotency-Key |
The seller-payment errors also apply to a charge with on_behalf_of.
Refunds
POST /refunds, GET /refunds, GET /refunds/:id. See Refunds.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; both or neither of checkout_id and charge_id; reason over 200 characters; a missing Idempotency-Key; limit is 1 to 100 | Fix the request |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key lacks refunds:write | Replace the key with one that has it. Only an Owner can issue it |
404 | 2783 | CHECKOUT_NOT_FOUND | No checkout by that checkout_id that your key may see | Check the id |
404 | 3001 | CHARGE_NOT_FOUND | No charge by that charge_id that your key may see | Check the id |
404 | 2864 | REFUND_REQUEST_NOT_FOUND | No refund by that id on your account | Check the id |
409 | 2861 | REFUND_NOT_ALLOWED | The payment cannot be refunded. data.reason says why: not_paid, nothing_left, other_refund, platform_payment, test_payment or not_inbound | Do not retry. See Refunds |
409 | 2862 | REFUND_ALREADY_OPEN | A refund of this payment is already waiting for MOOKHPay | Read it with GET /refunds?checkout_id=. Ask again once it is decided |
422 | 2702 | INVALID_AMOUNT | A part refund that is not whole currency units (a multiple of 100) | Send a multiple of 100, or leave amount out to refund all that is left |
422 | 2863 | REFUND_AMOUNT_TOO_HIGH | amount is more than is left to refund. data.refundable is what is left | Send data.refundable or less |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was used with a different body | Use a new key for a new refund |
Card element routes
The routes under /v1/payments/public/charges/:id/card that the card element (mookhpay.js) calls from the payer's browser. Your server never calls them, but the element passes their codes to your page. See Card payments.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
401 | 3006 | CHARGE_CLIENT_SECRET_INVALID | Unknown charge, wrong or missing client_secret, or past the charge's expires_at, all alike | Create a new charge and pass its client_secret |
402 | 2723 | COLLECTION_DECLINED | The card was declined. data.failure.code is insufficient_funds, limit_exceeded, rail_unavailable or declined, and data.failure.message is safe to show the payer. The charge stays pending | Let the payer try another card |
403 | 2776 | CARD_ORIGIN_NOT_ALLOWED | The Origin header is missing, null or not on your Card Payment Pages list | Add the page's origin in the hub. See Card payments |
403 | 2772 | CARD_TOKEN_INVALID | The card token came from another form | Reload the element |
403 | 2775 | CARD_SANDBOX_CURRENCY_BLOCKED | Card payments in this currency are not live on this deployment | Use mobile money |
409 | 3007 | CHARGE_NOT_PENDING | The charge has succeeded, failed, expired or been cancelled | Stop. Read the charge on your server |
409 | 2772 | CARD_TOKEN_INVALID | No card attempt is open for this charge | Open the attempt again (the element does this) |
409 | 2778 | CARD_CONTEXT_EXPIRED | The card form's capture context ran out | Refresh the element and have the payer enter the card again |
409 | 2777 | CARD_PAYMENT_IN_VERIFICATION | Another charge call for this attempt is already running | Wait for it. Do not charge again |
409 | 2786 | CHECKOUT_IN_PROGRESS | A card payment for this charge is already in flight | Wait for it to finish |
409 | 2707 | INTENT_FINALIZED | The attempt has already ended | Read the charge |
409 | 2773 | CARD_VERIFICATION_FAILED | CyberSource's answer could not be verified. The payer was not charged twice | Read the charge on your server before letting the payer retry |
409 | 2709 | WALLET_NOT_PROVISIONED | The payee's wallet does not exist | Retry later |
409 | 2784, 2785 | CHECKOUT_EXPIRED, CHECKOUT_PAID | The payment behind the charge has expired or been paid | Read the charge |
422 | 2771 | CARD_CURRENCY_NOT_SUPPORTED | Cards are not taken in this currency | Use mobile money |
422 | 1701 | INVALID_REQUEST_DATA | A charge call the card processor will not take | Reload the element |
502 | 2774 | CARD_CAPTURE_CONTEXT_FAILED | The card form could not be started | Retry once |
502 | 2779 | CARD_CHARGE_FAILED | CyberSource refused the call. data.failure.code is rail_unavailable. Nothing was taken | Let the payer try again |
503 | 2752 | LEDGER_UNAVAILABLE | The payee's wallet could not be checked | Retry |
429 | 1804 | RATE_LIMIT_EXCEEDED | Too many calls from this address or for this charge | Wait Retry-After seconds |
Seller accounts and reads (platforms)
POST /accounts, GET /accounts, GET /accounts/:id, GET /accounts/:id/balance, GET /accounts/:id/transactions, GET /transactions. The platform rows in Payments for a seller (2942, 3013, 2943, 1804, 3016) apply to every platform route.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; phone must be a number in this cluster's country; terms.accepted_at must be a real time, not in the future (more than 5 minutes ahead); to must be later than from; limit is 1 to 100 | Fix the request |
400 | 3012 | PLATFORM_CURSOR_INVALID | A cursor that was edited, came from another platform or account, or does not match the filters sent with it | Start the list again without a cursor. See Pagination |
404 | 3019 | PLATFORM_WALLET_NOT_FOUND | The account holds no wallet by that wallet slug. In pocket mode, any wallet other than your pocket's slug | Read the balance for the account's wallets |
409 | 3061 | PLATFORM_ACCOUNT_DISCONNECTED | Pocket mode. The account holder disconnected your platform in MOOKHPay. Answered on every route that names the account, instead of 404 2943, and not counted toward the unknown-id limit | Stop calling for the account. Mark it disconnected. See account.disconnected |
409 | 3063 | PLATFORM_POCKET_NOT_READY | Pocket mode. The pocket is still being opened, just after the account was made or linked | Retry in a few seconds |
409 | 2944 | PLATFORM_ACCOUNT_EXISTS | The phone already has a MOOKHPay account. Nothing was created | Link the account instead |
409 | 2945 | PLATFORM_REFERENCE_TAKEN | external_reference already names another of your accounts, with a different phone or name | Use the existing account, or a new reference |
409 | 3011 | PLATFORM_USERNAME_TAKEN | The username is taken | Leave username out, or choose another |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was used with a different body | Use a new key |
429 | 2950 | PLATFORM_DAILY_ACCOUNTS_REACHED | Your platform has created as many accounts as it may today (East Africa Time) | Retry tomorrow, or ask MOOKHPay to raise the cap |
503 | 2752 | LEDGER_UNAVAILABLE | Balances or wallet movements could not be read | Retry |
503 | 3020 | PLATFORM_FEED_UNAVAILABLE | The all-accounts feed is switched off on the ledger | Retry later. If it persists, contact MOOKHPay |
503 | 3016 | PLATFORM_ACCOUNTS_UNAVAILABLE | The account, or in pocket mode its pocket, could not be read | Retry |
Payouts
POST /accounts/:id/payouts, GET /accounts/:id/payouts, GET /accounts/:id/payouts/:payout_id. A payout refused after it was recorded (2732, 2726, 2751, 2948, a failed approval filing) replays its refusal: the same Idempotency-Key and body answer the same code again. Other refusals are worked out again on each attempt.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; amount must be whole currency units (a multiple of 100); the body is not JSON | Fix the body |
400 | 3012 | PLATFORM_CURSOR_INVALID | starting_after is not one of this account's payouts, or on GET /refunds not one of its refunds | Use an id from the previous page |
401 | 3021 | PAYOUT_SIGNATURE_INVALID | X-Mookh-Timestamp or X-Mookh-Signature missing or malformed, the signature does not match, the signature was already used once, or the timestamp is more than 300 seconds from MOOKHPay's clock. The same on every signed route | Sign the timestamp, method, path, Idempotency-Key and the exact body bytes, with a fresh timestamp on every attempt. See How to sign a request |
403 | 3022 | PAYOUT_SIGNING_SECRET_MISSING | Your platform has no payout signing secret. The same on every signed route | An Owner makes one in the hub |
403 | 3025 | PLATFORM_GRANT_SCOPE_MISSING | The account holder did not give your platform payouts:write | Ask them to link again with that scope |
409 | 3061 | PLATFORM_ACCOUNT_DISCONNECTED | Pocket mode. The account holder disconnected your platform | Stop paying out to the account |
409 | 3063 | PLATFORM_POCKET_NOT_READY | Pocket mode. The pocket is still being opened | Retry in a few seconds, with the same key and a fresh signature |
404 | 3023 | PLATFORM_PAYOUT_NOT_FOUND | No such payout on this account for your platform | Check both ids |
422 | 2701 | RAIL_NOT_AVAILABLE | The payout rail is not available on this host | Contact MOOKHPay |
422 | 2702 | INVALID_AMOUNT | amount is outside the payout rail's limits | See Limits |
422 | 2731 | DISBURSEMENT_DISABLED | Payouts are switched off on this host | Contact MOOKHPay |
422 | 2732 | INSUFFICIENT_BALANCE | The seller's main wallet, or in pocket mode your pocket, does not hold the amount plus the payout fee. See Fees | Read the balance first |
422 | 3037 | PLATFORM_COMPANY_ACCOUNTS_OFF | Pocket mode, and the account is a company. A company's payouts are not paid from a pocket today | Nothing in the request can change it |
422 | 2751 | LEDGER_BOOKING_FAILED | The ledger refused to reserve the money for another reason | Read the account. Retry later with a new key |
422 | 2947 | PLATFORM_PAYOUT_CAP_REACHED | The payout would pass your platform's daily payout cap. data is { cap, used, remaining } | Wait for the next day (East Africa Time), or send remaining or less |
422 | 2948 | PLATFORM_ACCOUNT_LIMIT_REACHED | The payout would pass the account's daily limit on money out. data is { cap, used, remaining } | Wait, or have the seller pass the identity check |
422 | 3040 | PLATFORM_PAYOUT_DESTINATION_INVALID | The seller's payout account or phone is not a number the rail can pay. data is { source }, payout_account or phone | Ask the seller to change it in MOOKHPay; nothing in the request can |
422 | 2949 | PLATFORM_PAYOUT_NO_DESTINATION | The seller has no payout account and no phone | Ask the seller to choose a payout account in MOOKHPay |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was used with a different amount or remark | Use a new key |
423 | 2726 | POCKET_LOCKED | The seller's wallet is locked | Wait until the lock ends |
503 | 3016 | PLATFORM_ACCOUNTS_UNAVAILABLE | The seller's payout details could not be read | Retry with the same key and a fresh signature |
A payout for a company account is filed for its owners' signatures. If MOOKHPay cannot file it, the payout is refused with the code the approval service gives, and that refusal is replayed like any other.
Pay-ins and payout destinations (pockets)
POST /accounts/:id/transfers, GET /accounts/:id/transfers, GET /accounts/:id/transfers/:transfer_id, POST /accounts/:id/payout-destination and POST /accounts/:id/payout-destination/verify. The errors these routes answer themselves carry data.error; the shared checks (key, scope, platform, signature, unknown account, schema, per-minute rate limit) do not. See Pay into your users' pockets.
A pay-in refused for your balance (3060) is recorded: the same Idempotency-Key and body answer 3060 again. Its external_reference is used up too. Top up, then send the pay-in with a new key and a new external_reference.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; a missing Idempotency-Key; amount not whole currency units (data.reason says so); limit outside 1 to 100 | Fix the request |
400 | 3012 | PLATFORM_CURSOR_INVALID | starting_after is not one of this account's pay-ins | Use a transfer_id from the previous page |
401 | 3021 | PAYOUT_SIGNATURE_INVALID | The signature was refused, as for payouts | See How to sign a request |
403 | 2941 | API_KEY_SCOPE_REQUIRED | A pay-in without transfers:write; a pay-in read without transfers:write or accounts:read; a payout destination call without payouts:write | Replace the key with one that has the scope |
403 | 3022 | PAYOUT_SIGNING_SECRET_MISSING | Your platform has no signing secret | An Owner makes one in the hub |
404 | 2943 | PLATFORM_ACCOUNT_NOT_FOUND | The account is unknown, another platform's or malformed | Check the id. Each miss is counted |
404 | 3067 | PLATFORM_TRANSFER_NOT_FOUND | No pay-in by that id on this account for your platform | Check both ids |
409 | 3061 | PLATFORM_ACCOUNT_DISCONNECTED | The account holder disconnected your platform | Stop paying in. The money already in the pocket stays theirs |
409 | 3063 | PLATFORM_POCKET_NOT_READY | The pocket is still being opened | Retry in a few seconds, with the same key and a fresh signature |
409 | 2945 | PLATFORM_REFERENCE_TAKEN | external_reference already names another of your pay-ins | Use the pay-in you already made, or a new reference |
422 | 3060 | PLATFORM_BALANCE_INSUFFICIENT | Your main balance does not hold amount. data.available is your main balance | Top up your main balance, then send with a new key and a new external_reference |
422 | 3062 | PLATFORM_TRANSFER_CAP_REACHED | The pay-in would pass your platform's daily pay-in cap (East Africa Time). data is { cap, used, remaining }. A cap of 0 means MOOKHPay has not set one yet, and every pay-in is refused | Send remaining or less, wait for the next day, or ask MOOKHPay |
422 | 3064 | PLATFORM_POCKET_NOT_SET_UP | Your platform has no pocket set up by MOOKHPay | Ask MOOKHPay to set up your pocket |
422 | 3040 | PLATFORM_PAYOUT_DESTINATION_INVALID | Payout destination: rail is not this country's (mpesa in Kenya), or phone is not a number the rail can pay | Send this country's rail and a number it can pay |
422 | 3065 | OTP_INVALID | Wrong code. data.tries_left says how many are left | Ask the person for the code again |
422 | 3066 | OTP_EXPIRED | The code is more than 10 minutes old, has been used, was entered wrong 5 times, or verification_id is unknown | Start again with POST /accounts/:id/payout-destination |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | A pay-in's Idempotency-Key used with a different body or account | Use a new key |
429 | 1804 | RATE_LIMIT_EXCEEDED | Over 120 pay-ins a minute, or 30 payout destination calls a minute, per platform; or a second code for the same account inside a minute (data.retry_after) | Wait, then retry |
503 | 3016 | PLATFORM_ACCOUNTS_UNAVAILABLE | The pocket could not be read, or a pay-in could not be booked yet. A pay-in left unbooked reads processing | Retry with the same Idempotency-Key, the same body and a fresh signature. The retry books it once |
503 | 2741 | PROVIDER_UNAVAILABLE | The code could not be texted. Nothing was saved | Retry |
Your own balance
GET /balance and GET /balance/transactions, with balance:read. See Retrieve your balance.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | limit is 1 to 100; to must be later than from; a bad date or an unknown parameter | Fix the query |
400 | 3012 | PLATFORM_CURSOR_INVALID | An edited cursor, or one sent with different filters | Start again without a cursor |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key lacks balance:read | Replace the key with one that has it. Only an Owner can issue it |
404 | 3019 | PLATFORM_WALLET_NOT_FOUND | You hold no wallet by that wallet slug | Read GET /balance for your wallets |
503 | 2752 | LEDGER_UNAVAILABLE | The ledger did not answer | Retry with backoff |
GET /fees refuses only with the key checks: 403 2941 for a key without accounts:read, payouts:write or transfers:write, and 403 2942 or 3013 like any platform route. See Fees.
Login links and account links
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | a login link takes no body; phone must be a number in this cluster's country; a scope your platform may not ask for | Fix the request |
403 | 3025 | PLATFORM_GRANT_SCOPE_MISSING | The account holder did not give your platform login_links:write | Ask them to link again with that scope |
404 | 2943 | PLATFORM_ACCOUNT_NOT_FOUND | Also answered for a business account, and for an account that is closed, banned or disabled | Login links are for a person's open account |
404 | 3027 | ACCOUNT_LINK_NOT_FOUND | No account link by that id for your platform | Check the id |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | An account link's Idempotency-Key used with a different phone or scopes | Use a new key |
429 | 3026 | LOGIN_LINK_LIMIT_REACHED | Too many login links from your key in a minute, or for this account in an hour | Make the link only when the seller taps the button |
Business account requests
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A schema error; a document upload that is not multipart/form-data with exactly the fields type and file; submit takes no body | Fix the request |
400 | 3038 | PLATFORM_TERMS_REQUIRED | MOOKHPay holds no terms attestation for this account, so terms is needed | Send terms |
400 or 413 | 3034 | ORG_REQUEST_DOCUMENT_REJECTED | The file was not accepted; 413 when it is over 10 MB. data says why | Send one PDF, JPEG or PNG of 10 MB or less |
403 | 3037 | PLATFORM_COMPANY_ACCOUNTS_OFF | A company request, and your platform is not switched on for companies | Ask MOOKHPay, or ask for a sole proprietorship |
404 | 3028 | ORG_REQUEST_NOT_FOUND | No such request on this account for your platform | Check both ids |
409 | 3029 | ORG_REQUEST_ALREADY_OPEN | The seller already has a different request open | Read the open request |
409 | 3030 | ORG_REQUEST_USERNAME_TAKEN | The business username is taken | Choose another |
409 | 3031 | ORG_REQUEST_MISSING_DOCUMENTS | Submitted with documents still missing. data lists them | Attach them, then submit |
409 | 3032 | ORG_REQUEST_BAD_DIRECTOR | A director cannot be named. data says why | Fix the directors |
409 | 3033 | ORG_REQUEST_WRONG_STATE | The request cannot be changed or sent in its current state | Read the request |
409 | 3035 | PLATFORM_ACCOUNT_UNCLAIMED | The seller has not claimed their account | Wait for account.claimed |
409 | 3036 | PLATFORM_ACCOUNT_NOT_A_PERSON | The account is a business, not a person | Ask for the person's account |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key used with a different body | Use a new key |
Keys and webhooks in the hub
These come from the hub's own routes, not from a merchant route. The hub words them for you; they are listed so a code in a support conversation can be placed.
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 2763 | API_KEY_ALLOWLIST_ENTRY_INVALID | An entry on Allowed Addresses is not an IPv4 or IPv6 address or a CIDR range. Nothing was saved | Fix the entry |
403 | 2601 | OWNER_ONLY | Someone other than an Owner tried to set allowed addresses, or to replace or revoke a key with a scope beyond checkouts | Ask an Owner |
404 | 2815 | WEBHOOK_DELIVERY_NOT_FOUND | Resend on a delivery that does not exist, or is older than 30 days and was removed | Recover by reading the object. See Retries and ordering |
409 | 2816 | WEBHOOK_DELIVERY_PENDING | Resend on a delivery that is still pending | Wait for it to be delivered or fail. Its retries are still running |
409 | 2817 | WEBHOOK_ENDPOINT_INACTIVE | Resend on a delivery whose endpoint is switched off | Switch the endpoint on, then resend |
Payer routes
The hosted checkout page calls /v1/payments/public/checkouts/:id, …/pay and …/card. These are the payer's errors, not your server's. Your server still confirms with GET /checkouts/:id.
| HTTP | Code | Name | When |
|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | A phone the rail cannot prompt, or a bad payer_email |
403 | 2776 | CARD_ORIGIN_NOT_ALLOWED | The card form was asked for from a page MOOKHPay does not serve |
403 | 2775 | CARD_SANDBOX_CURRENCY_BLOCKED | Cards in this currency are not live here |
404 | 2783 | CHECKOUT_NOT_FOUND | No checkout by that id, or its payee can no longer be paid |
409 | 2784 | CHECKOUT_EXPIRED | The checkout has expired |
409 | 2785 | CHECKOUT_PAID | The checkout has been paid |
409 | 2786 | CHECKOUT_IN_PROGRESS | A card payment is already in flight |
409 | 2836 | CHECKOUT_TEST_MODE | A test checkout and a number that is not a test number, or a card on a test checkout |
409 | 2851 | CHECKOUT_CARD_ONLY | A card top-up paid by mobile money |
409 | 2946 | PLATFORM_BALANCE_PAY_UNAVAILABLE | A checkout taken through a platform paid from a MOOKHPay balance |
409 | 2709 | WALLET_NOT_PROVISIONED | The payee's wallet does not exist |
422 | 2701, 2702, 2721 | RAIL_NOT_AVAILABLE, INVALID_AMOUNT, COLLECTION_DISABLED | The rail cannot take this payment |
422 | 2838 | TEST_NUMBER_LIVE | A test number on a real checkout |
422 | 2771 | CARD_CURRENCY_NOT_SUPPORTED | No card payments in this currency |
422, 503 | 2854, 2853 | FX_NOT_OFFERED, FX_RATE_UNAVAILABLE | Paying a card in another currency is not offered, or has no current rate |
502 | 2774 | CARD_CAPTURE_CONTEXT_FAILED | The card form could not be started |
503 | 2752 | LEDGER_UNAVAILABLE | The payee's wallet could not be checked |
429 | 1804 | RATE_LIMIT_EXCEEDED | Too many attempts for this phone, checkout or address |
Charge failure codes
Not HTTP errors. A charge that ends failed (mobile money), or a card charge that expires after a decline, carries failure: { code, message }. The same object is on payment.failed as failure when the payment was a charge. message is safe to show the payer.
failure.code | Message | Typical cause |
|---|---|---|
payer_cancelled | The payer cancelled the prompt | M-Pesa result 1032; MoMo APPROVAL_REJECTED, TRANSACTION_CANCELED |
insufficient_funds | The payer did not have enough money for this payment | M-Pesa 1; MoMo NOT_ENOUGH_FUNDS; card INSUFFICIENT_FUND |
wrong_pin | The payer entered a wrong PIN | M-Pesa 2001, 8006 |
prompt_timed_out | The prompt was not answered in time | M-Pesa 1019; MoMo EXPIRED |
phone_unreachable | The payer's phone could not be reached | M-Pesa 1001, 1037; MoMo PAYER_NOT_FOUND |
limit_exceeded | The payment is over a limit on the payer's account | M-Pesa 2–5, 8; MoMo payer or payee limits; card EXCEEDS_CREDIT_LIMIT |
rail_unavailable | The payment network could not take the payment | M-Pesa 17, 26, 1025, 9999; MoMo service errors; card processor or issuer unavailable |
declined | The payment was declined | Every other decline, and any result MOOKHPay does not recognise |
On a test charge the test numbers give insufficient_funds, prompt_timed_out and payer_cancelled.
Payout failure codes
Not HTTP errors. A payout that ends failed carries failure: { code, message } on the payout and on the platform's payout.failed. The money is back in the seller's wallet in every case.
failure.code | Message |
|---|---|
rail_unavailable | The payment network could not send the payout. The money is back in the wallet |
recipient_unreachable | The number cannot receive this payout. The money is back in the wallet |
limit_exceeded | The payout is over a limit on the network. The money is back in the wallet |
declined | The payout was declined. The money is back in the wallet |
A payout that was never handed to the rail fails as rail_unavailable. A result MOOKHPay does not recognise is declined.
Retry or not
| Result | What to do |
|---|---|
Network error, timeout, 500, 503 | Retry with the same body and the same Idempotency-Key, with backoff. Sign a payout, pay-in or payout destination call again with a fresh timestamp |
429 | Wait Retry-After seconds, then retry with the same key |
409 2709, 409 3063 | Retry after a few seconds |
409 3061 | Stop. The account holder disconnected your platform |
409 3002 | Wait for the pending charge to end or cancel it, then create a new charge with a new key |
Any other 4xx | Change the request. The same request fails the same way |
See Idempotency for how retries are matched to the first request.