Skip to content

The checkout object ​

A checkout is one order with a fixed amount, paid on MOOKHPay's hosted page. Create a checkout and Retrieve a checkout answer it in data.

A checkout can have several payment attempts (a declined prompt, then a successful one). payment describes the latest. A checkout is paid at most once.

Example ​

json
{
  "id": "cs_ke_3f9a1c7e5b2d4a8e6c0b91d7",
  "url": "https://mookhpay.co/checkout/cs_ke_3f9a1c7e5b2d4a8e6c0b91d7",
  "status": "completed",
  "test": false,
  "amount": "150000",
  "currency": "KES",
  "reference": "order-1042",
  "description": "2 lattes and a mandazi",
  "line_items": [
    { "description": "Latte", "amount": "60000", "quantity": 2 },
    { "description": "Mandazi", "amount": "30000", "quantity": 1 }
  ],
  "return_url": "https://shop.example.com/paid",
  "account": "acct_ke_9c2f41b07e5d38a6c1f0b294",
  "platform_fee": 15000,
  "net": 135000,
  "expires_at": "2026-11-20T09:30:00.000Z",
  "created_at": "2026-11-20T09:00:00.000Z",
  "payment": {
    "intent_id": "pi_8c1e4f0a7b3d92e5a6f01c48",
    "status": "completed",
    "amount_settled": "150000",
    "provider_receipt": "TKL4XQ2B9M",
    "reference": "SM8K2QF7",
    "phone": "254712345678",
    "rail": "mpesa",
    "method": "mpesa"
  }
}

Fields ​

FieldTypeNullableMeaning
idstringNocs_<country>_<24 hex>. The country (ke, ug) is the host that holds it
urlstringNoThe hosted page to send the payer to
statusstringNoopen, completed or expired. See below
testbooleanNotrue for a checkout opened by a Pay Button test key (pk_test_…), and for the checkout behind a test direct charge made with an mkp_test_ key (its hosted_url). A checkout you create with POST /checkouts and a secret key is never a test, on any deployment
amountstringNoMinor units, as a string. What the payee is paid. A card fee, when the payer pays by card, is added on top for the payer and is not in this figure
currencystringNoKES or UGX, from the host
referencestringYesYour order number, as sent
descriptionstringYesAs sent
line_itemsarrayYesAs sent, each { description, amount, quantity }, with amount a string and quantity filled in as 1 where you left it out. null when none were sent
return_urlstringYesAs sent
accountstring—Only on a checkout made with on_behalf_of: the seller's account id. Absent otherwise
platform_feeinteger—Only with on_behalf_of: the platform's fee in minor units. A number, not a string
netinteger—Only with on_behalf_of: amount less platform_fee, what the seller receives
expires_atstringNoISO 8601. 30 minutes after creation by default (CHECKOUT_TTL_SECONDS)
created_atstringNoISO 8601
paymentobjectYesThe latest attempt, or null before anyone tries to pay

payment ​

FieldTypeNullableMeaning
intent_idstringNoThe attempt's id, pi_…. Webhooks name the same attempt as intent_id
statusstringNocreated, reserved, submitted, pending, completed, failed, expired or reversed
amount_settledstringYesMinor units, as a string, once the rail has answered. On a card attempt it includes the card fee
provider_receiptstringYesThe rail's own reference: the M-Pesa receipt, the CyberSource transaction id, or MOOKHPay's ledger reference for a balance payment
referencestringYesMOOKHPay's receipt reference (SM…), once the payment is booked to the ledger
phonestringYesThe payer's number as the rail has it, unmasked. Empty for a payment from a MOOKHPay balance
railstringNoWhat the attempt rode on, as MOOKHPay names it internally, such as mpesa, momo, card-uc (a card) or mookhpay (a MOOKHPay balance). The rail on payment.succeeded and payment.failed is the same value
methodstringYesHow the payer paid, in your words: mpesa, momo, airtel, card (either card form) or mookhpay (their MOOKHPay balance). null for a rail this list does not know yet. Branch on this rather than on rail

Status ​

status is worked out from the latest attempt and the clock each time you read it.

StatusMeaningCan be paid
openNot paid, and either before expires_at or with an attempt still in flight (created, reserved, submitted or pending)Yes
completedThe latest attempt completed. Fulfil the orderNo
expiredPast expires_at with no attempt in flight and none completedNo

An attempt in flight keeps the checkout open after expires_at: a prompt approved in time can be answered late by the rail. A checkout that is open past its expires_at can therefore still become completed.

ChangeWebhook
An attempt is bookedpayment.succeeded
An attempt failspayment.failed. The checkout stays open until it expires, and the payer can try again

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