Skip to main content

Pay-In · Bangladesh

TOPPAY TeamAbout 3 min

Overview

Pay-in API for collecting payments from customers in Bangladesh (country code bd). Two order modes are supported:

ModePathDescription
Cashier/pay/prePayDefault. Returns cashierUrl; the customer pays on the platform H5 cashier
API/pay/transOrdermethod is required. Returns payData / payDataType (upstream payment page URL)
  • Amounts are in BDT. Pay-in does not accept a non-zero fraction: use a positive integer Taka (e.g. 100, 100.0, 100.00 are accepted; 100.50 is rejected).
  • See Regional Payment Guide — Bangladesh for method codes and extra fields.

Integration note

Cashier mode is enabled by default. Contact support to whitelist the merchant before integrating API mode.

Request Headers

Shared by both modes:

FieldRequiredTypeDescription
Content-TypeMStringFixed: application/json

Cashier Mode (prePay)

Create a pre-order, receive cashierUrl, and send the customer to the platform cashier to choose a method and pay.

Endpoint

Domain: Prefer unified host openapi.toppayment.com (path unchanged); legacy country domain (e.g. global-bd-openapi.toppayment.com) remains available.

EnvironmentURL
Sandboxhttps://openapi.toppayment.com/sandbox/bd/pay/prePay
Productionhttps://openapi.toppayment.com/bd/pay/prePay

Request Body

FieldRequiredTypeDescription
mchNoMString(32)Merchant number
orderNumMString(64)Merchant order number
amountMNumberAmount in BDT as a positive integer Taka (100.00 is treated as an integer; 100.50 is rejected)
productDetailMString(100)Product description
methodOString(16)Optional; if omitted, the customer chooses at the cashier. See Bangladesh guide
timestampMString(13)Millisecond timestamp
customerNameMString(64)Customer name
customerEmailMString(64)Customer email
customerPhoneOString(32)Customer wallet number — recommended format: starts with 01, 11 digits total
downNotifyUrlMString(255)Webhook URL
redirectUrlOString(512)Redirect URL after payment
signMStringRSA signature — see Signature

Request Examples

{
    "mchNo": "{{mchNo}}",
    "orderNum": "BD1234561",
    "amount": 1000.00,
    "productDetail": "test",
    "method": "BKASH",
    "timestamp": "1749451858772",
    "customerName": "Rahim Uddin",
    "customerEmail": "[email protected]",
    "customerPhone": "01880612345",
    "downNotifyUrl": "https://example.com/notify",
    "redirectUrl": "https://example.com/paid",
    "sign": "Generate per signature rules and replace"
}

Response Body Parameters

FieldRequiredTypeDescription
successMBooleanWhether the request succeeded
codeMString9999: success; otherwise failure
msgOStringMessage; null on success
timeStampMNumberResponse timestamp (ms)
dataMObjectPayload
orderNumMStringMerchant order number
platOrderNumMStringPlatform order number
amountMNumberAmount
feeMNumberFee
methodOStringPayment method (may be empty if not sent in the request)
productDetailMStringProduct description
customerNameMStringCustomer name
customerEmailMStringCustomer email
customerPhoneOStringCustomer wallet number
validTimeMNumberExpiry timestamp (ms)
cashierUrlMStringPlatform cashier URL

Response note

Cashier mode does not return payData / payDataType. Those fields appear only in API mode.

Response Example

{
    "success": true,
    "code": "9999",
    "msg": null,
    "timeStamp": 1767840272829,
    "data": {
        "orderNum": "BD1234561",
        "platOrderNum": "BDPTJ2009093829059153920",
        "amount": 1000.00,
        "fee": 20.00,
        "method": "BKASH",
        "productDetail": "test",
        "customerName": "Rahim Uddin",
        "customerEmail": "[email protected]",
        "customerPhone": "01880612345",
        "validTime": 1767926672819,
        "cashierUrl": "https://example.cashier/pay"
    }
}

API Mode (transOrder)

Specify the payment method in the request, place the order directly with the channel, and receive payData / payDataType without the platform H5 cashier.

Endpoint

EnvironmentURL
Sandboxhttps://openapi.toppayment.com/sandbox/bd/pay/transOrder
Productionhttps://openapi.toppayment.com/bd/pay/transOrder

Request Body

Differences from cashier mode:

FieldRequiredTypeDescription
methodMString(16)Payment method (Bangladesh)
Required in API mode. Supports BKASH, NAGAD — see Bangladesh guide

All other fields match cashier mode.

Request Examples

{
    "mchNo": "{{mchNo}}",
    "orderNum": "BDPAYINAPI1234561",
    "amount": 1000.00,
    "productDetail": "test",
    "method": "BKASH",
    "timestamp": "1749451858772",
    "customerName": "Rahim Uddin",
    "customerEmail": "[email protected]",
    "customerPhone": "01880612345",
    "downNotifyUrl": "https://example.com/notify",
    "redirectUrl": "https://example.com/paid",
    "sign": "Generate per signature rules and replace"
}

Response Body Parameters

Common fields (success, code, msg, timeStamp, and data.orderNum, platOrderNum, amount, fee, method, productDetail, customerName, customerEmail, customerPhone, validTime) match cashier mode. API mode focuses on:

FieldRequiredTypeDescription
payDataMStringPayment payload — usually an upstream payment page URL; meaning depends on payDataType
payDataTypeMStringPayment data type; Bangladesh wallet flows use CASHIER_URL
cashierUrlOStringMay also be returned; in API mode prefer payData

payDataType Reference

payDataTypeDescriptionTypical methods
CASHIER_URLUpstream payment page URLBKASH, NAGAD

Response Example

{
    "success": true,
    "code": "9999",
    "msg": null,
    "timeStamp": 1767840272829,
    "data": {
        "orderNum": "BDPAYINAPI1234561",
        "platOrderNum": "BDPTJ2009093829059153920",
        "amount": 1000.00,
        "fee": 20.00,
        "method": "BKASH",
        "productDetail": "test",
        "customerName": "Rahim Uddin",
        "customerEmail": "[email protected]",
        "customerPhone": "01880612345",
        "validTime": 1767926672819,
        "cashierUrl": "https://sg-cb.megipay.com/api/v1/sandbox/order.html?type=1&order_no=MegExample",
        "payData": "https://sg-cb.megipay.com/api/v1/sandbox/order.html?type=1&order_no=MegExample",
        "payDataType": "CASHIER_URL"
    }
}

Notification

Both modes share the same callback shape; status — see Transaction Status Codes. Reply with SUCCESS.