Quickstart
From a new sandbox account to a completed test payment in five minutes, using nothing but curl.
You'll create a sandbox account, get a secret test key, create a payment, pay it with a test card and confirm it through the API.
Create a sandbox account
Sign up at beta.sandbox-merchant.epay.lk. Sandbox signup is self-serve: confirm your email with the one-time code and your business is active immediately — no verification documents are needed in the sandbox.
Sandbox and production accounts are independent. Signing up for the sandbox doesn't create a production account, and production credentials never work in the sandbox.
Create a secret test key
In the sandbox dashboard go to Developers → API keys → Create secret key. Give it at least the payments:write and payments:read scopes. Copy the key — it starts with sk_test_ and is shown only once.
export EPAY_KEY="sk_test_..." # keep it out of source controlCreate a payment
Amounts are integers in minor units: 125000 is LKR 1,250.00.
curl https://beta.sandbox-api.epay.lk/v1/payments \
-H "Authorization: Bearer $EPAY_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: quickstart-order-1042" \
-d '{
"amount": 125000,
"currency": "LKR",
"description": "Order #1042",
"order_id": "1042",
"customer": { "name": "Nimal Perera", "email": "nimal@example.com" },
"return_url": "https://example.com/checkout/return",
"cancel_url": "https://example.com/cart"
}'{
"id": "pay_8Hq2LxV0cT4mZr7N",
"object": "payment",
"status": "requires_payment",
"amount": 125000,
"currency": "LKR",
"order_id": "1042",
"checkout_url": "https://beta.sandbox-pay.epay.lk/c/cs_Q2h4...",
"livemode": false,
"expires_at": "2026-11-22T11:15:00.000Z"
}checkout_url is returned only in this create response. Redirect the payer there right away (or store it).
Pay with a test card
Open checkout_url in your browser and choose Card. You'll be sent to the bank simulator — enter:
| Field | Value |
|---|---|
| Card number | 4242 4242 4242 4242 |
| Expiry | any future date, e.g. 12/30 |
| CVC | any 3 digits |
The simulator approves the payment, notifies ePay and sends you back to the checkout, which then offers Return to merchant — your return_url with ?payment_id=…&status=succeeded&order_id=1042 appended. See all test cards.
Confirm the payment on your server
Never fulfil an order based on the browser redirect alone. Check the payment status with your secret key:
curl https://beta.sandbox-api.epay.lk/v1/payments/pay_8Hq2LxV0cT4mZr7N \
-H "Authorization: Bearer $EPAY_KEY"{
"id": "pay_8Hq2LxV0cT4mZr7N",
"status": "succeeded",
"amount": 125000,
"fee": 3688,
"net": 121312,
"payment_method": { "type": "card", "card_brand": "visa", "card_last4": "4242" },
"succeeded_at": "2026-11-22T10:16:41.000Z"
}In production you'll usually rely on the payment.succeeded webhook instead of polling.
Next steps
Introduction
ePay is a Sri Lankan internet payment gateway. Accept card and LankaQR payments through a hosted checkout, with refunds, payment links, invoices and signed webhooks.
Environments & sandbox
Production and sandbox are separate deployments with separate accounts, keys, data and hostnames. Test everything in the sandbox with the bank simulator and test cards.

