Appearance
Public routes
The routes MOOKHPay's own payer pages call: the payment link page at mookhpay.co/<handle> and the hosted checkout page at mookhpay.co/checkout/<id>. They take no key and no session.
Build on the merchant API, not these
Your server should create a hosted checkout or a direct charge and confirm it with your secret key. The routes below are what a payer's browser calls on MOOKHPay's pages. They are rate limited per payer number and per IP, their answers are shaped for those pages, and none of them is a confirmation you should fulfil an order on. The card element's routes are on Card element routes.
| Prefix | /v1/payments/public |
| Host | The payments host for the country that holds the money. A checkout id carries its country (cs_ke_…, cs_ug_…); a handle's answer says served_here and home_country. A Kenyan checkout read on the Ugandan host is a 404. See Environments |
| Auth | None. A checkout id (96 random bits) or an intent id is the only thing standing in for a credential |
Resolve a handle or link
GET /v1/payments/public/handles/{handle}Who is being paid at a username, a payment link address, or a pocket address (<handle>:<slug>).
| Name | In | Type | Required | Constraints |
|---|---|---|---|---|
handle | path | string | Yes | ^[A-Za-z0-9._-]{1,64}$, or a pocket address <handle>:<slug> |
to | query | string | No | A list recipient's id (12 hex characters), from a link sent to a list |
sh
curl https://payments-ke-staging.mookhpay.co/v1/payments/public/handles/asha-rent200 OK. The answer is long; these are the fields a page uses most:
json
{
"ok": true,
"description": "Handle resolved",
"data": {
"name": "asha-rent",
"username": "asha",
"pay_to": "asha:rent",
"title": "Rent",
"amount": null,
"type": "plain",
"display_name": "Asha",
"profile_image_url": null,
"home_country": "KE",
"served_here": true,
"paused": false,
"closed": false,
"cap_reached": false,
"verified": false,
"business": false,
"currency": "KES",
"rail": "mpesa",
"min": "100",
"max": "15000000",
"paybill": null,
"accepting": true
}
}| Field | Meaning |
|---|---|
name | The address as written in the URL. On a link it differs from username |
username | The account that is paid |
pay_to | <owner>:<account slug> for a payment link; null for a handle or a pocket |
title, amount | A link's title and set amount, minor units as a string. null on a handle or an open link |
type, options | The link's type and the part of its options a payer needs. null for a handle |
served_here | false when this host does not hold the money. Money fields are then null and accepting is false. Call the home_country host. The description reads "Handle resolved elsewhere" |
paused | The owner paused the link. Still a 200, with accepting false and the description "This payment link is paused" |
closed, cap_reached | The link is past its closing time, or has taken all it was set to take |
verified, business | MOOKHPay verified the payee; the payee is an organisation. Both false when unknown |
currency, rail, min, max | How this host collects. Amounts in minor units, as strings |
paybill | The M-Pesa Pay Bill business number, or null |
accepting | The wallet exists and can take a payment |
Other fields (description, closes_at, due_date, settled_at, reference, logo_url, look, redirect_url, group, signup, recipient, card) are for the link page's own drawing. Owner-only details, such as a download's file address or a shop's stock count, are never returned.
| HTTP | Code | When |
|---|---|---|
404 | 2710 | No account, link or open pocket by that name, or an archived link |
503 | 2752 | The ledger did not answer. Not the same as accepting: false |
Rate limit: 120 a minute per client IP, 429 and code 1804.
Pay a handle or link by mobile money
POST /v1/payments/public/checkoutSends a mobile-money prompt to the payer's phone for a handle, link or pocket. A payment link prices its own order: the page sends what the link asks for (order, reference, instalments, plan_token, member_token, recipient_id) and the service refuses anything that does not fit.
| Header | Required | Value |
|---|---|---|
Idempotency-Key | Yes | 1 to 128 characters |
Content-Type | Yes | application/json |
| Field | Type | Required | Constraints |
|---|---|---|---|
handle | string | Yes | The address being paid |
amount | integer | Depends | Minor units, at least 1. Required for a handle, a pocket, a donation and a link with no set price. For a priced link it may be left out; when sent it must equal the price (400 2719 otherwise) |
phone | string | Yes | The payer's number: 9 to 15 digits, country code, no + |
rail | string | No | Defaults to the country's mobile-money rail |
payer_name, payer_email, message, show_name, reference | No | What the payer typed on the page |
202 Accepted when a prompt is sent, 200 OK on an idempotent replay:
json
{
"ok": true,
"description": "Checkout initiated",
"data": {
"intent_id": "pi_8c1e4f0a7b3d92e5a6f01c48",
"status": "pending",
"amount": "150000",
"currency": "KES",
"rail": "mpesa",
"message": "STK Push sent to your phone. Enter your M-Pesa PIN to complete."
}
}On a replay, message is "Duplicate request — returning existing intent".
| HTTP | Code | When |
|---|---|---|
400 | 1701 | The body breaks the schema, or the phone is not one this rail can prompt |
400 | 2719 | The order or amount does not fit the link |
404 | 2710 | Unknown or archived address |
409 | 2716 | The link is paused |
409 | 2720, 2727, 2728, 2729, 2730 | Sold out, slot taken, invoice paid, link closed, cap reached |
409 | 2709 | The payee's wallet is not set up yet |
422 | 2702 | The amount is outside the rail's limits |
422 | 2701, 2721 | No such rail here, or collection is switched off |
422 | 2838 | A test number used on a real payment |
Rate limits: 5 an hour per payer number, 600 an hour per address, 300 an hour per IP. 429 and code 1804.
Read an intent
GET /v1/payments/public/intents/{id}What a payer may know about their own payment. id is an intent_id (pi_ and hex). The answer carries no full phone number and no provider-side details beyond the receipt the payer's own SMS shows.
json
{
"ok": true,
"description": "Intent retrieved",
"data": {
"intent_id": "pi_8c1e4f0a7b3d92e5a6f01c48",
"status": "completed",
"amount_settled": "150000",
"currency": "KES",
"reference": "SM7K2Q9XWD",
"download": null,
"plan": null,
"receipt": {
"number": "TKL81XC3PQ",
"paid_at": "2026-11-20T10:02:11.000Z",
"payer_phone_masked": "+254 7•• ••• 678",
"rail": "mpesa",
"title": null
}
}
}| Field | Meaning |
|---|---|
status | created, reserved, submitted, pending, completed, failed, expired or reversed |
amount_settled | Minor units as a string, once settled; otherwise null |
reference | MOOKHPay's receipt reference (SM…) once booked, otherwise null |
download | { file_name, url } once a payment for a download link has completed, otherwise null |
plan | The instalment plan this payment belongs to, once completed, otherwise null |
receipt | { number, paid_at, payer_phone_masked, rail, title } once completed with a receipt number, otherwise null |
404 code 2706: unknown id. Rate limit: 240 a minute per IP. MOOKHPay's page polls this every 2.5 seconds for up to two minutes.
Read a hosted checkout
GET /v1/payments/public/checkouts/{id}The payer's view of a hosted checkout and who is being paid. id is cs_<country>_<24 hex>. Answered with Cache-Control: no-store.
json
{
"ok": true,
"description": "Checkout",
"data": {
"checkout": {
"id": "cs_ke_3f9a1c7e5b2d4a8e6c0b91d7",
"status": "open",
"test": false,
"amount": "150000",
"currency": "KES",
"fee_on_payer": false,
"purpose": "merchant",
"description": "2× Latte, 1× Mandazi",
"line_items": null,
"phone": null,
"intent_id": null,
"return_url": "https://yourshop.example/paid",
"redirect_url": null,
"paybill": { "business_number": "4123456", "account_number": "CS12345678" },
"mobile": { "rail": "mpesa", "fee": "0", "total": "150000" },
"card": { "fee": "2500", "total": "152500" },
"balance_available": true,
"expires_at": "2026-11-20T10:30:00.000Z",
"orderReference": "order-1042",
"paidAt": null,
"receiptNumber": null,
"payerPhoneMasked": null,
"rail": null,
"promptExpiresAt": null
},
"payee": {
"username": "kahawa",
"display_name": "Kahawa",
"amount": "150000",
"paybill": null,
"verified": true,
"business": true,
"via": null
}
}
}payee carries the same fields as Resolve a handle or link; the example shows only some.
| Field | Meaning |
|---|---|
status | open, completed or expired |
test | Only the test numbers can pay it |
fee_on_payer | true for a payment request or a top-up: amount is what the payee receives and each rail's total is what the payer is charged |
purpose | merchant, request or topup. A top-up can be paid by card only |
line_items | Your line_items, with each amount as a string, or null |
phone | The number you sent at create, or null. The payer can change it |
intent_id | The latest attempt still in flight, or the completed one; otherwise null |
redirect_url | Only once completed: your return_url with checkout, reference and status added |
paybill | Kenya Pay Bill numbers for this checkout, or null. account_number is CS and 8 digits |
mobile, card | { rail, fee, total } and { fee, total }, or null where that way to pay is not offered. A card fee is added for the payer; you receive amount |
balance_available | Paying from a MOOKHPay balance may be offered. false for a test checkout, a top-up and a checkout made through a platform |
orderReference | Your reference, while a merchant checkout is open and once completed. null once expired |
paidAt, receiptNumber, payerPhoneMasked, rail | Only once completed; otherwise null |
promptExpiresAt | Only while a mobile-money prompt is in flight |
payee.amount | The checkout amount, as a string. The payer cannot change it |
payee.paybill | Always null here. Menu payment uses checkout.paybill |
payee.via | null, or { username, display_name } of the platform the payment is taken through. The page reads <payee> via <platform> |
| HTTP | Code | When |
|---|---|---|
404 | 2783 | Unknown id, or the merchant cannot be paid on this host |
503 | 2752 | The ledger did not answer |
Rate limit: 120 a minute per IP.
Pay a hosted checkout by mobile money
POST /v1/payments/public/checkouts/{id}/paySends a mobile-money prompt for the checkout's amount. The amount and payee come from the checkout, never from the body.
| Header | Required | Value |
|---|---|---|
Idempotency-Key | Yes | 1 to 128 characters |
| Field | Type | Required | Constraints |
|---|---|---|---|
phone | string | Yes | 9 to 15 digits, country code, no + |
rail | string | No | Defaults to the country's mobile-money rail |
payer_email | string | No | Up to 254 characters. A malformed address is 400 1701 |
| HTTP | Code | When |
|---|---|---|
202 | A new prompt was sent. description is "Checkout initiated" | |
200 | An attempt is already in flight. description is "Checkout already in progress", and data names it | |
200 | An idempotent replay. description stays "Checkout initiated"; message is "Duplicate request — returning existing intent" | |
400 | 1701 | A field is invalid, the phone is not one the rail can prompt, or payer_email is malformed |
404 | 2783 | Unknown checkout, or its payee can no longer be paid |
409 | 2785 | Already paid |
409 | 2784 | Expired, and nothing is in flight |
409 | 2836 | A test checkout paid with a number that is not a test number |
409 | 2851 | A card top-up: card only |
409 | 2709 | The payee's wallet is not set up yet |
422 | 2838 | A test number used on a real checkout |
422 | 2701, 2721 | No such rail here, or collection is switched off |
422 | 2702 | The amount is outside the rail's limits |
503 | 2752 | The payee's wallet could not be checked |
The 202 body is as on Pay a handle or link, plus fee and requested where fee_on_payer is true. Poll Read an intent.
Rate limits: 5 an hour per payer number (a test number counts per checkout), 20 an hour per checkout, 300 an hour per IP.
Pay a hosted checkout by card
POST /v1/payments/public/checkouts/{id}/cardOpens a card payment on MOOKHPay's own hosted page. Offered only when checkout.card is not null. The card fee is the payer's, so you receive the checkout amount in full. The answer carries the session MOOKHPay's page needs to run the card form, including a single-use callback token, which is why only that page should call it. A direct charge uses the card element instead.
| Header | Required | Value |
|---|---|---|
Idempotency-Key | Yes | 1 to 128 characters |
Optional body fields: payer_name, payer_email, phone, card_form (uc or microform), and the saved-card and currency fields MOOKHPay's page uses.
202 for a new session, 200 for a replay, with description "Card payment initiated". data has intent_id, status, amount, fee, total, currency, rail (card-uc) and the card session fields.
| HTTP | Code | When |
|---|---|---|
404 | 2783 | Unknown checkout |
409 | 2785 | Already paid |
409 | 2784 | Expired |
409 | 2786 | Another payment for this checkout is in progress |
409 | 2836 | A test checkout, which cards cannot pay |
409 | 2709 | The payee's wallet is not set up yet |
422 | 2771 | Cards do not take this checkout's currency |
422 | 2725 | The pocket the checkout pays cannot take money |
403 | 2775 | Card payments for this currency are not live yet |
403 | 2776 | The page's origin is not one MOOKHPay's card form allows |
502 | 2774 | The card form could not be started |
503 | 2752 | The payee's wallet could not be checked |
Rate limits: 10 an hour per checkout, 200 an hour per IP.
Read a payee's profile
GET https://auth-ke-staging.mookhpay.co/v1/auth/public/profile/{handle}This route is on the auth host for the country (auth-ke-staging or auth-ug-staging), not the payments host. It returns the bio, theme, cover and social links the payer page draws. 404 when the handle does not exist.