Appearance
List charges for a reference
Lists the charges you made for one reference, newest first. Use it to find a charge whose create answer you lost, for example after a timeout, whichever account the charge pays.
It lists only charges your key's account made. It is not a general charge list: there is no route that lists charges without a reference, and there is no cursor.
Endpoint
GET /v1/payments/merchant/charges?reference={reference}| Auth | Secret key, Authorization: Bearer mkp_… |
| Scope | charges:write |
| Feature flag | Registered only where direct charges are on |
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer mkp_test_… or Bearer mkp_live_… |
Parameters
Query
Unknown query parameters are refused with 400 and code 1701.
| Name | Type | Required | Constraints and meaning |
|---|---|---|---|
reference | string | Yes | 1 to 64 characters. The reference you sent on create |
limit | string of digits | No | 1 to 100, default 20. Outside that range: 400, code 1701, limit is 1 to 100 |
Example request
sh
curl "https://payments-ke-staging.mookhpay.co/v1/payments/merchant/charges?reference=order-8841&limit=5" \
-H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
const query = new URLSearchParams({ reference: "order-8841", limit: "5" });
const res = await fetch(`${BASE}/charges?${query}`, {
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 pending = body.data.charges.find((charge) => charge.status === "pending");
console.log(pending ? pending.id : "no pending charge");python
import os
import requests
BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"
res = requests.get(
f"{BASE}/charges",
params={"reference": "order-8841", "limit": "5"},
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']}")
pending = next((c for c in body["data"]["charges"] if c["status"] == "pending"), None)
print(pending["id"] if pending else "no pending charge")php
<?php
$base = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
$query = http_build_query(["reference" => "order-8841", "limit" => "5"]);
$ch = curl_init("$base/charges?$query");
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']}");
}
foreach ($body["data"]["charges"] as $charge) {
echo $charge["id"], " ", $charge["status"], PHP_EOL;
}Response
200 OK. An empty list when you made no charge for that reference.
json
{
"ok": true,
"description": "Charges",
"data": {
"charges": [
{
"id": "ch_ke_7e1a4c9b2d5f80e3a6c1b047",
"status": "pending",
"test": false,
"amount": 150000,
"currency": "KES",
"fee": 0,
"net": 150000,
"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"
}
]
}
}Response fields
| Field | Type | Meaning |
|---|---|---|
charges | array | Up to limit charges, newest first, each as Retrieve a charge answers it: brought up to date on the read, with no client_secret |
Errors
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | reference missing or too long, limit outside 1 to 100, or an unknown parameter | Fix the query |
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 charges:write | 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 |
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 the other charge reads and the checkout routes. Over it: 429, code 1804, Retry-After in seconds.