Start here

Quickstart

5 minutes: get your API key, create an invoice, send the buyer to checkout, confirm verified.

1. Get your API key

Log in to your merchant dashboard → Webhooks → copy the API key. Each store has its own key — pick the right store in the navbar first if you have more than one.

store it securely
API_KEY=your_api_key_here

2. Create an invoice

POST/api/v1/payments

products is required — at least one line item.

curl
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 }
    ],
    "note": "Order #2041",
    "customerName": "Rafi Hasan",
    "customerPhone": "01711111111"
  }'
response
{
  "id": "987a15a8-c5d6-4e0d-94c6-523f8db581ee",
  "amount": 1490,
  "status": "pending",
  "payUrl": "http://localhost:3000/pay/987a15a8-..."
}

Save id on your order. Redirect the buyer to payUrl.

3. Buyer pays on hosted checkout

The buyer opens /pay/{id}, picks bKash / Nagad / Rocket, sends money to your number, and submits the TrxID.

4. Get notified (outbound webhook)

Set your server URL in Webhooks → Payment webhook. When a payment is matched (status becomes confirmed) we POST:

POST → your server
{
  "event": "payment.verified",
  "paymentId": "987a15a8-...",
  "storeId": "...",
  "amount": 1490,
  "currency": "BDT",
  "provider": "bkash",
  "trxId": "BKH8X2K1M",
  "payerNumber": "01711111111",
  "customerName": "Rafi Hasan",
  "note": "Order #2041",
  "products": [
    { "name": "T-Shirt (Blue, L)", "quantity": 2, "price": 590 },
    { "name": "Cap", "quantity": 1, "price": 310 }
  ],
  "verifiedAt": "2026-08-19T15:00:00.000Z"
}

Verify the X-TakaPay-Signature header before fulfilling the order.

5. Or poll the status

GET/api/v1/payments/:id

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

When status === "confirmed" the money has arrived — deliver the product, then POST /v1/payments/:id/confirm to mark it verified. Never fulfil on TrxID alone from the customer.