Appearance
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
| Field | Type | Nullable | Meaning |
|---|---|---|---|
id | string | No | cs_<country>_<24 hex>. The country (ke, ug) is the host that holds it |
url | string | No | The hosted page to send the payer to |
status | string | No | open, completed or expired. See below |
test | boolean | No | true 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 |
amount | string | No | Minor 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 |
currency | string | No | KES or UGX, from the host |
reference | string | Yes | Your order number, as sent |
description | string | Yes | As sent |
line_items | array | Yes | As 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_url | string | Yes | As sent |
account | string | — | Only on a checkout made with on_behalf_of: the seller's account id. Absent otherwise |
platform_fee | integer | — | Only with on_behalf_of: the platform's fee in minor units. A number, not a string |
net | integer | — | Only with on_behalf_of: amount less platform_fee, what the seller receives |
expires_at | string | No | ISO 8601. 30 minutes after creation by default (CHECKOUT_TTL_SECONDS) |
created_at | string | No | ISO 8601 |
payment | object | Yes | The latest attempt, or null before anyone tries to pay |
payment
| Field | Type | Nullable | Meaning |
|---|---|---|---|
intent_id | string | No | The attempt's id, pi_…. Webhooks name the same attempt as intent_id |
status | string | No | created, reserved, submitted, pending, completed, failed, expired or reversed |
amount_settled | string | Yes | Minor units, as a string, once the rail has answered. On a card attempt it includes the card fee |
provider_receipt | string | Yes | The rail's own reference: the M-Pesa receipt, the CyberSource transaction id, or MOOKHPay's ledger reference for a balance payment |
reference | string | Yes | MOOKHPay's receipt reference (SM…), once the payment is booked to the ledger |
phone | string | Yes | The payer's number as the rail has it, unmasked. Empty for a payment from a MOOKHPay balance |
rail | string | No | What 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 |
method | string | Yes | How 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.
| Status | Meaning | Can be paid |
|---|---|---|
open | Not paid, and either before expires_at or with an attempt still in flight (created, reserved, submitted or pending) | Yes |
completed | The latest attempt completed. Fulfil the order | No |
expired | Past expires_at with no attempt in flight and none completed | No |
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.
| Change | Webhook |
|---|---|
| An attempt is booked | payment.succeeded |
| An attempt fails | payment.failed. The checkout stays open until it expires, and the payer can try again |