API reference
Create, check and cancel payments; methods, invoices and links. JSON over HTTPS with a Bearer key.
Base URL: https://your-server/api/v1/ · Auth header: Authorization: Bearer pk_live_… (also accepted: X-API-Key). Bodies are JSON. Every answer has ok; errors look like {"ok":false,"error":"invalid_amount","message":"…"} with a matching HTTP status (400, 401, 403, 404, 409, 422, 429, 503).
Create a payment
POST /api/v1/payments
{"amount":"500.00","currency":"BDT","reference":"ORDER-1001",
"customer":{"name":"Rahim","email":"r@example.com","phone":"01712345678"},
"success_url":"https://shop.example.com/thanks","cancel_url":"https://shop.example.com/cart",
"webhook_url":"https://shop.example.com/ipn","methods":["bkash","nagad"],
"metadata":{"order_id":1001},"expires_in":3600}Answer 201:
{"ok":true,"payment":{"id":"PAY-7Q2M9XKD","status":"pending","amount":"500.00","currency":"BDT",
"checkout_url":"https://pay.example.com/checkout/PAY7Q2M9XKD","expires_at":"2026-11-16T11:15:00+06:00"}}Send the customer to checkout_url. Repeating the same reference while the earlier payment is still open returns that payment; send "new":true to force a new one.
Check a payment
GET /api/v1/payments/{id} or GET /api/v1/payments?reference=ORDER-1001
| status | meaning |
|---|---|
pending | created, not paid |
processing | the customer gave a TrxID; waiting for the SMS |
completed | paid — has paid_amount, paid_currency, method, trx_id, sender, paid_at |
failed, expired, cancelled, refunded | final states |
Other calls
| Call | Use |
|---|---|
GET /api/v1/methods?amount=500¤cy=BDT | methods this website can take for that amount |
POST /api/v1/payments/{id}/cancel | cancel an open payment |
POST /api/v1/payments/{id}/verify | when you collect the TrxID on your own page: method, trx_id, sender |
POST /api/v1/invoices | customer, items[{name,qty,price}], currency, due_date, note → invoice with url |
POST /api/v1/links | title, amount (or null for customer-entered), currency → reusable link url |
Example with curl
curl -X POST https://pay.example.com/api/v1/payments \
-H "Authorization: Bearer pk_test_xxx" -H "Content-Type: application/json" \
-d '{"amount":"250.00","currency":"BDT","reference":"TEST-1"}'