API reference
Overview
Base URLs, authentication, request format and every /v1 endpoint at a glance.
Base URLs
| Environment | Base URL | Keys |
|---|---|---|
| Production | https://beta.api.epay.lk | sk_live_… |
| Sandbox | https://beta.sandbox-api.epay.lk | sk_test_… |
All endpoints are versioned under /v1. Backwards-compatible changes (new endpoints, new optional parameters, new response fields, new event types) can happen at any time — write clients that ignore unknown fields.
Requests
- Authenticate with
Authorization: Bearer <secret key>(details). - Send JSON bodies with
Content-Type: application/json. - Send
Idempotency-KeyonPOST /v1/paymentsandPOST /v1/refunds(details). - Amounts are integer minor units; timestamps are ISO 8601 UTC; JSON keys are snake_case.
- Errors use the error envelope; lists use cursor pagination.
Endpoints
| Method | Path | Scope | Description |
|---|---|---|---|
POST | /v1/payments | payments:write | Create a payment and get a checkout_url |
GET | /v1/payments | payments:read | List payments (status, order_id) |
GET | /v1/payments/:id | payments:read | Retrieve a payment |
POST | /v1/payments/:id/cancel | payments:write | Cancel an unpaid payment |
POST | /v1/refunds | refunds:write | Refund a payment in full or in part |
GET | /v1/refunds | refunds:read | List refunds (payment_id) |
GET | /v1/refunds/:id | refunds:read | Retrieve a refund |
POST | /v1/payment_links | payment_links:write | Create a payment link |
GET | /v1/payment_links/:id | payment_links:read | Retrieve a payment link |
GET | /v1/events | events:read | List events (type) |
GET | /v1/events/:id | events:read | Retrieve an event |
GET | /v1/balance | balance:read | Pending, available and in-transit balance |
Rate limits
Requests are rate-limited per API key. Exceeding the limit returns 429 rate_limit_error / rate_limited; back off exponentially and retry. If you need sustained higher throughput, contact ePay.

