Payments API

Create invoice

Call this from your server backend — never from frontend JS. Returns a hosted checkout URL to redirect the buyer.

POST/api/v1/payments

Auth: X-Api-Key: YOUR_STORE_API_KEY

Request body

FieldTypeNotes
amountnumberRequired. BDT, must be > 0
productsarrayRequired. Non-empty — see below
customerNamestringRequired
customerPhonestringRequired
providerstring?bkash | nagad | rocket — omit for all
notestring?Order ID / free-text note
expiresInHoursnumber?1–168, default 24
redirectUrlstring?See "Redirecting after payment" below

The products array

Every payment must carry at least one line item — what the buyer is actually paying for. This is required so the same detail shows up later on the payment.verified webhook, letting your server fulfill the order without a second lookup.

FieldTypeNotes
namestringRequired, non-empty
quantitynumberRequired, must be > 0
pricenumberRequired, unit price in BDT, ≥ 0

products is informational — TakaPay doesn’t validate that quantity × price sums to amount. The customer pays exactly amount; line items are for your own order records.

request
curl -s https://pay.brainicsoft.com/api/v1/payments \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1490,
    "products": [
      { "name": "T-Shirt (Blue, L)", "quantity": 2, "price": 590 },
      { "name": "Cap", "quantity": 1, "price": 310 }
    ],
    "customerName": "Rafi Hasan",
    "customerPhone": "01711111111",
    "note": "Order #2041",
    "expiresInHours": 24,
    "redirectUrl": "https://yourdomain.com/orders/2041/complete"
  }'
response
{
  "id": "987a15a8-c5d6-4e0d-94c6-523f8db581ee",
  "amount": 1490,
  "currency": "BDT",
  "provider": null,
  "trxId": null,
  "status": "pending",
  "note": "Order #2041",
  "products": [
    { "name": "T-Shirt (Blue, L)", "quantity": 2, "price": 590 },
    { "name": "Cap", "quantity": 1, "price": 310 }
  ],
  "redirectUrl": "https://yourdomain.com/orders/2041/complete",
  "expiresAt": "2026-08-20T15:00:00.000Z",
  "createdAt": "2026-08-19T15:00:00.000Z",
  "payUrl": "https://yourdomain.com/pay/987a15a8-..."
}

Redirect the buyer to payUrl. Store id on your order to poll later.

Redirecting after payment

Set redirectUrl to send the buyer’s browser back to your site once the checkout page reaches a final state (verified or failed) — about 3 seconds after. Verification details are appended as query params:

redirect target
https://yourdomain.com/orders/2041/complete\
  ?paymentId=987a15a8-c5d6-4e0d-94c6-523f8db581ee\
  &status=verified\
  &trxId=BKH8X2K1M\
  &provider=bkash\
  &amount=1490

These query params are for UX only — not signed, and a customer could edit them in the browser. Before fulfilling the order, confirm the real status server-side with GET /api/v1/payments/:id (below), or rely on the payment.verified webhook as the source of truth.

Get payment status

GET/api/v1/payments/:id

curl
curl https://pay.brainicsoft.com/api/v1/payments/987a15a8-... \
  -H "X-Api-Key: $API_KEY"

List payments

GET/api/v1/payments

curl
curl https://pay.brainicsoft.com/api/v1/payments \
  -H "X-Api-Key: $API_KEY"