Skip to content

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}
AuthSecret key, Authorization: Bearer mkp_…
Scopecheckouts
Who can readThe payee reads its own checkouts. A platform reads the checkouts it made with on_behalf_of. Anybody else gets 404

Headers ​

HeaderRequiredValue
AuthorizationYesBearer mkp_test_… or Bearer mkp_live_…

Parameters ​

Path ​

NameTypeRequiredConstraints and meaning
idstringYescs_<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:

FieldTypeCheck
statusstringcompleted. open means not paid yet; expired means it can no longer be paid
amountstringEquals the amount of your order. It is a string
referencestring or nullEquals your order number
payment.referencestring or nullMOOKHPay's receipt reference (SM…) once the payment is booked
payment.methodstring or nullHow 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 ​

HTTPCodeNameWhenWhat to do
4001701INVALID_REQUEST_DATAid is not a checkout id's shapeCheck the id
4003014IDENTITY_HEADER_REFUSEDThe request carries a session or identity headerRemove the header
4012781API_KEY_INVALIDMissing, malformed, unknown or revoked keyCheck the key
4032941API_KEY_SCOPE_REQUIREDThe key lacks checkoutsIssue a key with the scope
4033042API_KEY_IP_NOT_ALLOWEDThe account has allowed addresses and the call came from another addressCall from a listed address
4042783CHECKOUT_NOT_FOUNDNo such checkout, or it belongs to someone else. The two are not told apartCheck the id and that it was made with this account's key
4291804RATE_LIMIT_EXCEEDEDOver the rate limitWait Retry-After seconds
5032782AUTHN_UNAVAILABLEKeys cannot be checkedRetry 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.

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