Appearance
Retrieve a checkout
Reads one checkout and the latest payment attempt on it. Call it before you fulfil an order: the payer's arrival at return_url is not proof of payment.
It reads only. It does not refresh anything at the rail and it cannot reach another merchant's checkout.
Endpoint
GET /v1/payments/merchant/checkouts/{id}| Auth | Secret key, Authorization: Bearer mkp_… |
| Scope | checkouts |
| Who can read | The payee reads its own checkouts. A platform reads the checkouts it made with on_behalf_of. Anybody else gets 404 |
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer mkp_test_… or Bearer mkp_live_… |
Parameters
Path
| Name | Type | Required | Constraints and meaning |
|---|---|---|---|
id | string | Yes | cs_<2 lowercase letters>_<24 hex>. Any other shape is refused with 400 and code 1701 |
Example request
sh
curl https://payments-ke-staging.mookhpay.co/v1/payments/merchant/checkouts/cs_ke_3f9a1c7e5b2d4a8e6c0b91d7 \
-H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
const id = "cs_ke_3f9a1c7e5b2d4a8e6c0b91d7";
const res = await fetch(`${BASE}/checkouts/${id}`, {
headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
});
const body = await res.json();
if (!body.ok) throw new Error(`${res.status} ${body.code}: ${body.description}`);
const checkout = body.data;
if (checkout.status === "completed" && checkout.amount === "150000") {
console.log("Paid. Receipt:", checkout.payment.provider_receipt);
}python
import os
import requests
BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"
checkout_id = "cs_ke_3f9a1c7e5b2d4a8e6c0b91d7"
res = requests.get(
f"{BASE}/checkouts/{checkout_id}",
headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
timeout=30,
)
body = res.json()
if not body["ok"]:
raise RuntimeError(f"{res.status_code} {body['code']}: {body['description']}")
checkout = body["data"]
if checkout["status"] == "completed" and checkout["amount"] == "150000":
print("Paid. Receipt:", checkout["payment"]["provider_receipt"])php
<?php
$base = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
$id = "cs_ke_3f9a1c7e5b2d4a8e6c0b91d7";
$ch = curl_init("$base/checkouts/$id");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY")],
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if (!$body["ok"]) {
throw new RuntimeException("$status {$body['code']}: {$body['description']}");
}
$checkout = $body["data"];
if ($checkout["status"] === "completed" && $checkout["amount"] === "150000") {
echo "Paid. Receipt: ", $checkout["payment"]["provider_receipt"], PHP_EOL;
}Response
200 OK. A completed checkout:
json
{
"ok": true,
"description": "Checkout",
"data": {
"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": null,
"return_url": "https://shop.example.com/paid",
"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"
}
}
}Response fields
data is the checkout object. Before you fulfil, check:
| Field | Type | Check |
|---|---|---|
status | string | completed. open means not paid yet; expired means it can no longer be paid |
amount | string | Equals the amount of your order. It is a string |
reference | string or null | Equals your order number |
payment.reference | string or null | MOOKHPay's receipt reference (SM…) once the payment is booked |
payment.method | string or null | How the payer paid: mpesa, momo, airtel, card or mookhpay (their MOOKHPay balance). Use it to show the method on your receipt. payment.rail is the rail itself, as the webhooks name it |
Errors
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | id is not a checkout id's shape | Check the id |
400 | 3014 | IDENTITY_HEADER_REFUSED | The request carries a session or identity header | Remove the header |
401 | 2781 | API_KEY_INVALID | Missing, malformed, unknown or revoked key | Check the key |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key lacks checkouts | Issue a key with the scope |
403 | 3042 | API_KEY_IP_NOT_ALLOWED | The account has allowed addresses and the call came from another address | Call from a listed address |
404 | 2783 | CHECKOUT_NOT_FOUND | No such checkout, or it belongs to someone else. The two are not told apart | Check the id and that it was made with this account's key |
429 | 1804 | RATE_LIMIT_EXCEEDED | Over the rate limit | Wait Retry-After seconds |
503 | 2782 | AUTHN_UNAVAILABLE | Keys cannot be checked | Retry with backoff |
Rate limit
120 requests a minute per key owner, shared with Create a checkout and the charge reads. Over it: 429, code 1804, Retry-After in seconds. A key check is cached for 60 seconds on this route, so a key revoked in the last minute can still read.
If you poll, poll every few seconds and stop at expires_at. Prefer webhooks.