Skip to Content
ePay.lkDocs
Payments

Retrieve, list & cancel

Look up a payment, list and filter payments, and cancel an unpaid payment.

Retrieve a payment

GET/v1/payments/:idscope payments:read
curl https://beta.api.epay.lk/v1/payments/pay_8Hq2LxV0cT4mZr7N \
  -H "Authorization: Bearer $EPAY_SECRET_KEY"

Returns the Payment object (without checkout_url). A payment that belongs to another account — or doesn't exist — returns 404 resource_missing.

List payments

GET/v1/paymentsscope payments:read
Query parameterDescription
statusOne status or a comma-separated list, e.g. succeeded,partially_refunded
order_idExact match on your order_id
limit1–100, default 20
cursornext_cursor from the previous page
curl "https://beta.api.epay.lk/v1/payments?status=succeeded&limit=50" \
  -H "Authorization: Bearer $EPAY_SECRET_KEY"
{
  "object": "list",
  "data": [{ "id": "pay_8Hq2LxV0cT4mZr7N", "object": "payment", "status": "succeeded", "amount": 125000 }],
  "has_more": true,
  "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMlQxMDoxNTowMC4wMDBaIiwiaWQiOiJwYXlfOEhxMkx4VjBjVDRtWnI3TiJ9"
}

Results are newest first. See Pagination for walking through all pages.

Find a payment by your order

GET /v1/payments?order_id=1042 is the easiest way to reconcile when you only have your own reference — for example if a browser redirect was lost.

Cancel a payment

POST/v1/payments/:id/cancelscope payments:write

Cancels a payment that is still requires_payment — for example when the payer changes their cart and you create a new payment instead. The checkout link stops working and a payment.canceled webhook is sent.

curl -X POST https://beta.api.epay.lk/v1/payments/pay_8Hq2LxV0cT4mZr7N/cancel \
  -H "Authorization: Bearer $EPAY_SECRET_KEY"

Returns the payment with status: "canceled". Any other status — including a payment that's already canceled — fails with 409 payment_not_cancelable. A processing payment will resolve on its own, and a succeeded one must be refunded instead.

On this page