Check a Payment
Webhooks tell you when a payment finishes. Use these endpoints as a backup:
- On your return page, if the webhook hasn't arrived yet.
- For orders still pending after 30 minutes. Cancelled and expired payments don't send a webhook yet.
- After downtime on your server, to catch up on payments you missed.
Get one payment
Look up a payment by BillPay's ID or by your own order reference:
curl https://sandbox.api.billpay.et/api/v1/checkout/payments/by-reference/order-10231 \
-H "x-api-key: $BILLPAY_API_KEY"
The response is the same payment object
you got when you created the payment, with two differences: checkoutUrl is
null, and attempts lists each try the customer made. Read status: only
CAPTURED means paid.
{
"statusCode": 200,
"message": "Payment fetched successfully",
"body": {
"id": "cae54780-b884-4253-829c-1069e1d41e3c",
"merchantReference": "order-10231",
"status": "CAPTURED",
"checkoutUrl": null,
"completedAt": "2026-10-31T17:27:15.005299Z",
"attempts": [
{
"id": "45e92faf-4565-48de-9d7b-9f134ceed4e4",
"attemptNo": 1,
"provider": "SANDBOX_WALLET",
"instrument": "TEST_WALLET",
"payerReference": "****4567",
"status": "SUCCEEDED",
"failureCode": null,
"failureReason": null,
"createdAt": "2026-10-31T17:25:02.380725Z",
"completedAt": "2026-10-31T17:27:15.005299Z"
}
]
},
"timestamp": "2026-10-31T17:52:55.077+00:00"
}
Both endpoints return 404 if the payment doesn't exist, or if it belongs to
another merchant.
async function getPaymentStatus(orderId) {
const res = await fetch(
`${process.env.BILLPAY_BASE_URL}/api/v1/checkout/payments/by-reference/${encodeURIComponent(orderId)}`,
{headers: {'x-api-key': process.env.BILLPAY_API_KEY}},
);
if (res.status === 404) return null;
const result = await res.json();
if (!res.ok) throw new Error(`BillPay ${result.statusCode}: ${result.message}`);
return result.body.status; // "CAPTURED", "EXPIRED", ...
}
List payments
Returns your payments, newest first.
CAPTURED.0.20, at most 100.Search payments
Find payments within a period of up to one year, with filters.
from.50, at most 100.nextCursor from the previous page.Search pages with a cursor, not page numbers. The response has hasNext and
nextCursor. While hasNext is true, send nextCursor back as cursor
to get the next page. Search doesn't return a total count.
On the last page, hasNext is false and nextCursor is null.
Search only returns payments created between from and to. To include
your newest payments, set to to the current time.
Follow changes
The change feed returns every payment whose status or refunded amount changed since your last call, oldest change first. It's a good safety net next to webhooks.
- Call it once without
since. The response has acursor. - Save the
cursor. - Every few seconds, call it again with
?since=<cursor>. Handle the payments it returns, then save the newcursor. IfhasMoreistrue, more changes are waiting, so call again right away.
The change feed uses cursor and hasMore. Payment search uses
nextCursor and hasNext. Check which endpoint you're calling.