Appearance
The charge object
A charge is one payment taken from your own screen: a mobile-money prompt, a Pay Bill payment or a card in the card element. Create a charge, Retrieve a charge, List charges for a reference and Cancel a charge answer it.
Every charge has a hosted checkout behind it (hosted_url), so the same payment can also be finished on the hosted page.
Example
json
{
"id": "ch_ke_7e1a4c9b2d5f80e3a6c1b047",
"status": "pending",
"test": false,
"amount": 150000,
"currency": "KES",
"fee": 0,
"net": 135000,
"account": "acct_ke_9c2f41b07e5d38a6c1f0b294",
"platform_fee": 15000,
"reference": "order-8841",
"description": "A3 print",
"payment_method": { "type": "mobile_money", "rail": "mpesa", "phone": "+254 7•• ••• 678" },
"next_action": {
"type": "await_payer",
"expires_at": "2026-11-20T09:20:00.000Z",
"display": "Enter your M-Pesa PIN on your phone"
},
"failure": null,
"receipt_number": null,
"hosted_url": "https://mookhpay.co/checkout/cs_ke_0b4d2f7a9c1e53b8d6a2e410",
"metadata": { "till": "4" },
"expires_at": "2026-11-20T09:20:00.000Z",
"created_at": "2026-11-20T09:14:00.000Z"
}Fields
| Field | Type | Nullable | Meaning |
|---|---|---|---|
id | string | No | ch_<country>_<24 hex> |
status | string | No | pending, succeeded, failed, expired or cancelled. See below |
test | boolean | No | true for a charge made with an mkp_test_ key. A test charge is paid only by the test numbers and never booked |
amount | integer | No | Minor units. A number, not a string |
currency | string | No | KES or UGX |
fee | integer | No | Always 0 today. A card fee is the payer's and is not taken from amount |
net | integer | No | What the payee receives: amount, or amount less platform_fee on a charge made with on_behalf_of |
account | string | — | Only with on_behalf_of: the seller's account id |
platform_fee | integer | — | Only with on_behalf_of: the platform's fee in minor units |
reference | string | No | Your order id |
description | string | Yes | As sent |
payment_method | object | No | See below |
next_action | object | Yes | What the payer has to do, while pending. null otherwise |
failure | object | Yes | { code, message } once failed, and on an expired card charge the last decline. null otherwise |
receipt_number | string | Yes | The rail's receipt (the M-Pesa receipt, for example) once succeeded, where the rail gives one. A test charge's receipt starts with TEST |
hosted_url | string | No | The same payment on the hosted page |
metadata | object | No | Your string pairs, {} when none were sent |
expires_at | string | No | ISO 8601. 6 minutes after creation for mobile_money, 30 minutes for paybill and card, by default |
created_at | string | No | ISO 8601 |
payment_method
| Type | Shape |
|---|---|
mobile_money | { "type": "mobile_money", "rail": "mpesa" | "momo", "phone": "+254 7•• ••• 678" }. The phone is masked to its first four and last three digits |
paybill | { "type": "paybill" } |
card | { "type": "card" } |
next_action
| Type | Fields | Show the payer |
|---|---|---|
await_payer | expires_at, display (for example Enter your M-Pesa PIN on your phone, or Approve the MTN MoMo prompt on your phone) | display, and a countdown to expires_at |
pay_to_paybill | business_number, account_number, amount (minor units), expires_at | The business number, the account number and the exact amount |
use_card_element | client_secret (create answer and its repeat only), expires_at, amount, fee, total, currency | Mount the card element with the client_secret; show total as what the card is charged |
failure.code
| Code | Message |
|---|---|
payer_cancelled | The payer cancelled the prompt |
insufficient_funds | The payer did not have enough money for this payment |
wrong_pin | The payer entered a wrong PIN |
prompt_timed_out | The prompt was not answered in time |
phone_unreachable | The payer’s phone could not be reached |
limit_exceeded | The payment is over a limit on the payer’s account |
rail_unavailable | The payment network could not take the payment |
declined | The payment was declined |
A rail answer MOOKHPay does not map reads as declined.
Status
| From | To | When | Webhook |
|---|---|---|---|
| — | pending | Created | None |
pending | succeeded | The payment is booked | payment.succeeded, with charge and metadata |
pending | failed | A mobile-money prompt failed. A card decline does not fail the charge: the payer can try another card | payment.failed |
pending | expired | expires_at passed with nothing booked | charge.expired. An expired card charge whose card attempt was opened by the element, with nothing still in flight, also sends payment.failed (its failure is the last decline, or null if no card was tried). A card charge whose element never opened an attempt sends only charge.expired |
pending | cancelled | You cancelled it | charge.cancelled |
expired or cancelled | succeeded | A prompt already on the phone was approved late. Checked for up to 7 days | payment.succeeded |
succeeded is final. A Pay Bill charge does not fail: it stays pending until it is paid, expires or is cancelled.