Skip to content

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 ​

FieldTypeNullableMeaning
idstringNoch_<country>_<24 hex>
statusstringNopending, succeeded, failed, expired or cancelled. See below
testbooleanNotrue for a charge made with an mkp_test_ key. A test charge is paid only by the test numbers and never booked
amountintegerNoMinor units. A number, not a string
currencystringNoKES or UGX
feeintegerNoAlways 0 today. A card fee is the payer's and is not taken from amount
netintegerNoWhat the payee receives: amount, or amount less platform_fee on a charge made with on_behalf_of
accountstring—Only with on_behalf_of: the seller's account id
platform_feeinteger—Only with on_behalf_of: the platform's fee in minor units
referencestringNoYour order id
descriptionstringYesAs sent
payment_methodobjectNoSee below
next_actionobjectYesWhat the payer has to do, while pending. null otherwise
failureobjectYes{ code, message } once failed, and on an expired card charge the last decline. null otherwise
receipt_numberstringYesThe 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_urlstringNoThe same payment on the hosted page
metadataobjectNoYour string pairs, {} when none were sent
expires_atstringNoISO 8601. 6 minutes after creation for mobile_money, 30 minutes for paybill and card, by default
created_atstringNoISO 8601

payment_method ​

TypeShape
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 ​

TypeFieldsShow the payer
await_payerexpires_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_paybillbusiness_number, account_number, amount (minor units), expires_atThe business number, the account number and the exact amount
use_card_elementclient_secret (create answer and its repeat only), expires_at, amount, fee, total, currencyMount the card element with the client_secret; show total as what the card is charged

failure.code ​

CodeMessage
payer_cancelledThe payer cancelled the prompt
insufficient_fundsThe payer did not have enough money for this payment
wrong_pinThe payer entered a wrong PIN
prompt_timed_outThe prompt was not answered in time
phone_unreachableThe payer’s phone could not be reached
limit_exceededThe payment is over a limit on the payer’s account
rail_unavailableThe payment network could not take the payment
declinedThe payment was declined

A rail answer MOOKHPay does not map reads as declined.

Status ​

FromToWhenWebhook
—pendingCreatedNone
pendingsucceededThe payment is bookedpayment.succeeded, with charge and metadata
pendingfailedA mobile-money prompt failed. A card decline does not fail the charge: the payer can try another cardpayment.failed
pendingexpiredexpires_at passed with nothing bookedcharge.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
pendingcancelledYou cancelled itcharge.cancelled
expired or cancelledsucceededA prompt already on the phone was approved late. Checked for up to 7 dayspayment.succeeded

succeeded is final. A Pay Bill charge does not fail: it stays pending until it is paid, expires or is cancelled.

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