Overview
The Bill Payment API lets aggregators pay Sri Lankan bills and top up mobile numbers from a prefunded float. You create a bill payment, and CeyPay debits your float and pays the biller in LKR. Your end-user doesn’t make a payment to CeyPay. These are the same floats that fund your offramps. The biller is always paid in LKR;floatCurrency decides what pays for it:
LKR— the bill’s amount comes straight off your LKR float. No conversion and no quote.USDT— you lock a rate withGET /v1/aggregator/quoteand pass thefxLockId; the quoted USDT comes off your USDT float.
Endpoints
Authentication
Every endpoint requires HMAC authentication with these headers:x-api-key: Your API key ID only (for example,ak_live_xxx)x-timestamp: Current Unix timestamp in millisecondsx-signature: HMAC-SHA256 signature (using the derived signing key)
How It Works
1
Register the customer
Call
POST /v1/aggregator/user with the customer’s verified identity, once. A bill is a crypto-to-fiat conversion like an off-ramp, so CeyPay must hold the originator record for whoever it is paid for. Keep the returned userId.2
Find the biller
Call
GET /v1/bill/list and take the biller’s code. Don’t hardcode biller codes — the list can change.3
Check the account (optional)
Call
POST /v1/bill/check to confirm the account exists and see the account holder and amount due. For mobile reloads, pass amount to see which package it buys.4
Lock a rate (USDT float only)
Paying from your USDT float? Call
GET /v1/aggregator/quote with amount_lkr set to the bill’s amount to see what it costs in USDT, and keep the fxLockId. It is the same quote endpoint offramps use. Skip this step entirely when paying from your LKR float.5
Create the bill payment
Call
POST /v1/bill/payment with the biller code, account number, LKR amount, floatCurrency and the customer’s userId — plus the fxLockId if you are paying in USDT. CeyPay debits that float and sends the payment to the biller immediately. Store the returned billPaymentId.6
Track the result
Receive a
bill.status_changed webhook on your webhookUrl, or poll GET /v1/bill/payment/:id. If the biller fails the payment, CeyPay returns exactly what it debited to the float it came from.List Billers
Returns the billers and mobile operators you can pay, with the account format and LKR limits for each.Query Parameters
Example Request
Example Response
Biller Fields
Check Account
Validates an account with the biller before you create a payment. Returns the account holder and the amount due or balance, where the biller supports lookups.Request Body
Example Request
Example Response
Response Fields
Some billers, such as TV providers, don’t support account lookups. For these, CeyPay checks only the account number format and returns
supported: true with no account holder.Error Responses
Get a Quote
USDT-float bills use the shared aggregator quote:GET /v1/aggregator/quote. Pass amount_lkr set to the bill’s amount and you get back the USDT it costs, rounded up to 8 decimal places, locked for 60 seconds.
Create Bill Payment
Pays a bill or reload from one of your floats. CeyPay debits that float and sends the payment to the biller in the same request. The biller is paid in LKR whichever float you use.Headers
Request Body
Choosing a float
Sending
fxLockId with the LKR float is rejected with 400, as is omitting it with the USDT float. A rejected request debits nothing, creates nothing, and leaves the rate lock unspent.
Don’t send
provider. Bills are paid from your float, so requests that include it return 400.Example Request
Example Response
Response Fields
Error Responses
A rejected or held request never debits your float, creates no bill payment, and leaves your rate lock unspent.
Idempotency
Send anIdempotency-Key header to retry a create request safely:
- Same key, same body: CeyPay returns the original bill payment without debiting your float again. A retry may carry a fresh
fxLockId— locks expire in 60 seconds, so it is not part of what makes a request “the same”, and the new lock stays unspent. - Same key, different body: CeyPay rejects the request with
422.
merchantTradeNo also prevents duplicates, but a repeated merchantTradeNo returns 409 instead of the original bill payment.
Get Bill Payment
Returns a single bill payment. Use it to poll status.Path Parameters
Example Request
Example Response (Completed)
Error Responses
List Bill Payments
Returns your bill payments, newest first.Query Parameters
Example Request
Example Response
Bill Payment Status
Refunds
If the biller rejects the payment, the status moves toFAILED and CeyPay returns exactly what it debited to the float it came from — the bill’s LKR for an LKR-float bill, the quoted USDT for a USDT-float one. It is never reconverted at a later rate, so a rate move between the bill and its failure costs you nothing. The refund object shows the return:
refund stays null until the amount is back on your float. CeyPay retries a delayed return automatically, so a FAILED bill with refund: null resolves without action from you.
Float Movements
Each bill payment appears in your Float Balance Ledger Report with itsbillPaymentId:
DEBITwhen you create the bill paymentREFUNDif the biller fails it — the same amount returns to your float
currency=USDT to see USDT-funded bills.
Webhooks
SetwebhookUrl when you create a bill payment to receive bill.status_changed events. CeyPay sends one when the bill payment reaches a final status: COMPLETED or FAILED.
Payload
Payload Fields
A failed bill payment normally produces a single
FAILED webhook, sent after CeyPay returns the LKR to your float, so refund.status is already COMPLETED. If the return is delayed, you first receive FAILED with refund: null, then a second FAILED webhook with refund.status: COMPLETED once the LKR is back.
Bill webhooks use the same ED25519 signature headers and retry policy as payment webhooks. See Webhooks for signature verification and retries.
Error Responses
See Error Codes for detailed error handling.
Related Documentation
- Offramp — LKR float and Float Balance Ledger Report
- Authentication — HMAC signature details
- Webhooks — Signature verification and retry policy
- Rate Limits — API rate limiting