Skip to content

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
HostThe 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
AuthNone. A checkout id (96 random bits) or an intent id is the only thing standing in for a credential
GET /v1/payments/public/handles/{handle}

Who is being paid at a username, a payment link address, or a pocket address (<handle>:<slug>).

NameInTypeRequiredConstraints
handlepathstringYes^[A-Za-z0-9._-]{1,64}$, or a pocket address <handle>:<slug>
toquerystringNoA 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-rent

200 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
  }
}
FieldMeaning
nameThe address as written in the URL. On a link it differs from username
usernameThe account that is paid
pay_to<owner>:<account slug> for a payment link; null for a handle or a pocket
title, amountA link's title and set amount, minor units as a string. null on a handle or an open link
type, optionsThe link's type and the part of its options a payer needs. null for a handle
served_herefalse 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"
pausedThe owner paused the link. Still a 200, with accepting false and the description "This payment link is paused"
closed, cap_reachedThe link is past its closing time, or has taken all it was set to take
verified, businessMOOKHPay verified the payee; the payee is an organisation. Both false when unknown
currency, rail, min, maxHow this host collects. Amounts in minor units, as strings
paybillThe M-Pesa Pay Bill business number, or null
acceptingThe 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.

HTTPCodeWhen
4042710No account, link or open pocket by that name, or an archived link
5032752The ledger did not answer. Not the same as accepting: false

Rate limit: 120 a minute per client IP, 429 and code 1804.

POST /v1/payments/public/checkout

Sends 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.

HeaderRequiredValue
Idempotency-KeyYes1 to 128 characters
Content-TypeYesapplication/json
FieldTypeRequiredConstraints
handlestringYesThe address being paid
amountintegerDependsMinor 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)
phonestringYesThe payer's number: 9 to 15 digits, country code, no +
railstringNoDefaults to the country's mobile-money rail
payer_name, payer_email, message, show_name, referenceNoWhat 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".

HTTPCodeWhen
4001701The body breaks the schema, or the phone is not one this rail can prompt
4002719The order or amount does not fit the link
4042710Unknown or archived address
4092716The link is paused
4092720, 2727, 2728, 2729, 2730Sold out, slot taken, invoice paid, link closed, cap reached
4092709The payee's wallet is not set up yet
4222702The amount is outside the rail's limits
4222701, 2721No such rail here, or collection is switched off
4222838A 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
    }
  }
}
FieldMeaning
statuscreated, reserved, submitted, pending, completed, failed, expired or reversed
amount_settledMinor units as a string, once settled; otherwise null
referenceMOOKHPay's receipt reference (SM…) once booked, otherwise null
download{ file_name, url } once a payment for a download link has completed, otherwise null
planThe 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.

FieldMeaning
statusopen, completed or expired
testOnly the test numbers can pay it
fee_on_payertrue 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
purposemerchant, request or topup. A top-up can be paid by card only
line_itemsYour line_items, with each amount as a string, or null
phoneThe number you sent at create, or null. The payer can change it
intent_idThe latest attempt still in flight, or the completed one; otherwise null
redirect_urlOnly once completed: your return_url with checkout, reference and status added
paybillKenya 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_availablePaying from a MOOKHPay balance may be offered. false for a test checkout, a top-up and a checkout made through a platform
orderReferenceYour reference, while a merchant checkout is open and once completed. null once expired
paidAt, receiptNumber, payerPhoneMasked, railOnly once completed; otherwise null
promptExpiresAtOnly while a mobile-money prompt is in flight
payee.amountThe checkout amount, as a string. The payer cannot change it
payee.paybillAlways null here. Menu payment uses checkout.paybill
payee.vianull, or { username, display_name } of the platform the payment is taken through. The page reads <payee> via <platform>
HTTPCodeWhen
4042783Unknown id, or the merchant cannot be paid on this host
5032752The ledger did not answer

Rate limit: 120 a minute per IP.

Pay a hosted checkout by mobile money ​

POST /v1/payments/public/checkouts/{id}/pay

Sends a mobile-money prompt for the checkout's amount. The amount and payee come from the checkout, never from the body.

HeaderRequiredValue
Idempotency-KeyYes1 to 128 characters
FieldTypeRequiredConstraints
phonestringYes9 to 15 digits, country code, no +
railstringNoDefaults to the country's mobile-money rail
payer_emailstringNoUp to 254 characters. A malformed address is 400 1701
HTTPCodeWhen
202A new prompt was sent. description is "Checkout initiated"
200An attempt is already in flight. description is "Checkout already in progress", and data names it
200An idempotent replay. description stays "Checkout initiated"; message is "Duplicate request — returning existing intent"
4001701A field is invalid, the phone is not one the rail can prompt, or payer_email is malformed
4042783Unknown checkout, or its payee can no longer be paid
4092785Already paid
4092784Expired, and nothing is in flight
4092836A test checkout paid with a number that is not a test number
4092851A card top-up: card only
4092709The payee's wallet is not set up yet
4222838A test number used on a real checkout
4222701, 2721No such rail here, or collection is switched off
4222702The amount is outside the rail's limits
5032752The 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}/card

Opens 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.

HeaderRequiredValue
Idempotency-KeyYes1 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.

HTTPCodeWhen
4042783Unknown checkout
4092785Already paid
4092784Expired
4092786Another payment for this checkout is in progress
4092836A test checkout, which cards cannot pay
4092709The payee's wallet is not set up yet
4222771Cards do not take this checkout's currency
4222725The pocket the checkout pays cannot take money
4032775Card payments for this currency are not live yet
4032776The page's origin is not one MOOKHPay's card form allows
5022774The card form could not be started
5032752The 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.

Staging documentation. A checkout made with a secret key on staging charges a real phone. See Environments.