bKash
bKash Tokenized Checkout in taka: the four merchant credentials, how a payment is created and confirmed, sandbox testing and troubleshooting.
The bKash plugin takes payments with the bKash Tokenized Checkout. The client presses a button on the invoice, is sent to bKash to confirm the payment with their wallet, and comes back to the invoice. It works in Bangladeshi taka (BDT) only: on an invoice in another currency the gateway is not offered. It is free and made for shops that sell to clients in Bangladesh and have a bKash merchant account. If you only have a personal bKash number, use Mobile Wallet instead. Shared gateway behaviour is in Payment gateways.
Switching it on
- Open Setup → Payment Gateways, tab All Payment Gateways, press Activate on bKash.
- Enter the four credentials and save.
- Test in the sandbox, then switch Test mode off.
Activation creates a small table in which the plugin remembers every payment it starts; uninstalling the plugin drops it.
Settings
| Setting | Meaning |
|---|---|
| Display name, Payment instructions, Fee %, Fixed fee | The settings every gateway has. |
| Test mode | Use the bKash sandbox. |
| App key | From the bKash merchant portal (the Tokenized Checkout credentials). |
| App secret | Goes with the app key. |
| Username | The merchant API user name. |
| Password | The merchant API password. |
All four credentials are needed; without them the invoice shows bKash is not set up yet: some credentials are missing. The app secret and the password are hidden fields: leave them empty to keep the saved value.
What bKash needs from you
- A bKash merchant account with Tokenized Checkout switched on, and the four credentials above. bKash gives live credentials at onboarding and separate sandbox credentials for testing.
- The Callback URL of this gateway, shown at the bottom of the settings page:
https://billing.example.com/callback/bkash. The plugin gives it to bKash with every payment it creates, so there is nothing to type into a bKash screen. If bKash asks you during onboarding which web address and return address you will use, give them your site address and this callback address. - HTTPS on your site and the PHP
curlextension.
How a payment goes
- The client presses Pay ... with bKash on an unpaid invoice. The invoice currency must be BDT.
- AIOBilling asks bKash for a token, creates a payment for the balance due (with your callback address and a unique invoice reference) and remembers it. The browser goes to the bKash page.
- The client confirms. bKash sends the browser back to the callback address with the payment ID and a status of
success,failureorcancel. - On
successthe plugin executes the payment with bKash. If the answer is not final (for example after a page reload), it asks bKash for the payment status instead. - The payment counts only if bKash says Completed, the currency is BDT, the amount equals the amount asked for and the invoice reference matches. Because every payment was remembered when it was created, a callback can only ever pay the invoice and amount it was made for.
- The bKash transaction ID (the trxID) becomes the transaction on the invoice and the invoice is marked paid. A
failureorcancelshows the client a warning and records nothing.
There is no separate server-to-server notice in this plugin: the payment is recorded when the client's browser returns. If a client says they paid in bKash but the invoice is unpaid, find the payment in the bKash merchant portal and record it with Add Payment on the invoice.
Refunds
AIOBilling does not send refunds to bKash. Refund from the bKash merchant portal and record it on the invoice's Refund tab with Offline refund (record only).
Testing in the sandbox
- Ask bKash for sandbox credentials and enter them, then switch Test mode on.
- Make an unpaid invoice in BDT for a test client and pay it from the client area with the test wallet bKash gives you.
- The invoice should turn Paid and show the trxID. Repeat once with cancel to see that nothing is recorded.
- Replace the credentials with the live ones and switch Test mode off.
Troubleshooting
Check Billing → Gateway Log (filter bKash) and Utilities → Module Log.
| Message or result | Cure |
|---|---|
| bKash takes Bangladeshi taka only. | The invoice is not in BDT. |
| bKash could not start the payment: ... | bKash's own words follow, usually a wrong credential, or a sandbox credential used in live mode (or the reverse). Check Test mode. |
token failed | The app key, app secret, username or password is wrong. |
unknown payment / This payment was not started here. | The callback names a payment this site did not create. |
amount mismatch / The confirmed payment does not match the invoice. | bKash confirmed another amount or reference. Check it in the merchant portal. |
status failure or status cancel | The client did not finish the payment. |
More general help is in Troubleshooting.
Was this helpful?
Updated 2026-11-03