Appearance
Retrieve a refund
Reads one refund on your account, as it stands now. It returns refunds asked for through the API and in the hub alike.
Endpoint
GET /v1/payments/merchant/refunds/{id}| Auth | Secret key |
| Scope | refunds:write |
| Switched on | Per deployment (REFUND_API_ENABLED). Where it is off, the route answers 404 |
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer mkp_… |
Parameters
Path
| Name | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | The refund's id, rf_ and 24 hex characters |
Example request
sh
curl https://payments-ke-staging.mookhpay.co/v1/payments/merchant/refunds/rf_5b1e8c2d7a4f90b3e6a1c2d8 \
-H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
const res = await fetch(`${BASE}/refunds/rf_5b1e8c2d7a4f90b3e6a1c2d8`, {
headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
});
const answer = await res.json();
if (!answer.ok) throw new Error(`${res.status} ${answer.code}: ${answer.description}`);
console.log(answer.data.status, answer.data.decline_reason);python
import os
import requests
BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"
res = requests.get(
f"{BASE}/refunds/rf_5b1e8c2d7a4f90b3e6a1c2d8",
headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
timeout=15,
)
answer = res.json()
if not answer["ok"]:
raise RuntimeError(f"{res.status_code} {answer['code']}: {answer['description']}")
print(answer["data"]["status"], answer["data"]["decline_reason"])php
<?php
$base = 'https://payments-ke-staging.mookhpay.co/v1/payments/merchant';
$ch = curl_init("$base/refunds/rf_5b1e8c2d7a4f90b3e6a1c2d8");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('MOOKHPAY_SECRET_KEY')],
]);
$answer = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (!$answer['ok']) {
throw new RuntimeException("$status {$answer['code']}: {$answer['description']}");
}
echo $answer['data']['status'], PHP_EOL;Response
200 OK with description Refund.
json
{
"ok": true,
"description": "Refund",
"data": {
"id": "rf_5b1e8c2d7a4f90b3e6a1c2d8",
"status": "declined",
"amount": 50000,
"fee": 0,
"currency": "KES",
"reason": "One latte was not served",
"decline_reason": "The payer has already been refunded by the shop directly.",
"checkout_id": "cs_ke_3f9a1c7e5b2d4a8e6c0b91d7",
"charge_id": null,
"intent_id": "pi_8c1e4f0a7b3d92e5a6f01c48",
"reference": "order-1042",
"provider_receipt": null,
"method": null,
"requested_via": "api",
"requested_at": "2026-11-21T07:40:12.000Z",
"reviewed_at": "2026-11-21T07:58:30.000Z",
"refunded_at": null
}
}Response fields
data is the refund object.
Errors
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 3014 | IDENTITY_HEADER_REFUSED | The request carries a session or identity header | Remove it |
401 | 2781 | API_KEY_INVALID | Missing, malformed, unknown or revoked key | Check the key |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key lacks refunds:write | Have an Owner replace the key with one that has it |
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 | 2864 | REFUND_REQUEST_NOT_FOUND | No refund by that id on your account. Another account's refund answers the same | Check the id |
429 | 1804 | RATE_LIMIT_EXCEEDED | Over the rate limit below | Wait Retry-After seconds |
503 | 2782 | AUTHN_UNAVAILABLE | The key could not be checked | Retry |
Rate limit
120 requests a minute per account, shared by the three refund routes. Over it: 429, code 1804, with Retry-After and data.retryAfter in seconds.