By the PAYJN Operations team
Your app or game is growing in Bangladesh, and customers keep asking the same thing: "Can I pay with bKash?" If your company is registered somewhere else, the first question is commercial: wallets usually reach international merchants through a payment provider rather than a direct merchant account with each wallet. The second question is engineering, and it is where most launches go wrong.
This is a checklist for that second part. It applies whichever provider you use. The companion repository has runnable examples and fourteen tests: payjn/bkash-nagad-topup-payouts (Node.js, no dependencies, everything fictional).
1. Offer all three wallets, and let the customer choose
bKash, Nagad and Upay each have their own customer base, and many customers hold only one. If you launch with bKash alone, part of your paying audience sees no option they can use.
Do not guess the wallet from the mobile operator prefix. A wallet account is not tied to one operator, so a number starting with 017 tells you nothing about which wallet the customer has. Show three buttons.
2. Normalise the mobile number once
Bangladeshi mobile numbers are 11 digits starting with 01, with a third digit from 3 to 9. Customers type them as +880 1712-345678, 8801712345678 or 01712 345678. Strip spaces and dashes, convert the 880 country code to a leading 0, validate, and store one canonical form.
const CANONICAL = /^01[3-9]\d{8}$/; export function normalizeBdMobile(input) { let d = String(input).replace(/[\s\-().]/g, '').replace(/^\+/, ''); if (!/^\d+$/.test(d)) return null; if (d.startsWith('880')) d = '0' + d.slice(3); return CANONICAL.test(d) ? d : null; } A naive length === 11 check rejects real customers with +880 and accepts numbers that cannot exist.
3. Store the order before the customer leaves your page
Create the top-up record, with its reference, amount, wallet and expiry, before you redirect to the wallet. If the callback arrives first and your database has nothing to match it to, you now have money with no order.
4. Treat your countdown as a screen event, not a money event
The customer confirms in the wallet, sometimes with a code that arrives by SMS, sometimes inside the wallet app. That can take longer than the countdown on your page. When your timer ends, stop waiting on screen, but keep the order open and keep checking it. If a verified success arrives later, deliver.
We wrote about this in detail in three timers you must keep separate.
5. Deliver exactly once, from two sources
Callbacks can repeat, arrive late or never arrive. Use both a verified callback and a status query by your own reference, and send both through the same function:
if (topup.status === 'delivered') return { status: 'duplicate' }; if (event.amountBdt !== topup.amountBdt) return hold('amount_mismatch'); if (event.wallet !== topup.wallet) return hold('wallet_mismatch'); // one transaction: mark delivered, store provider reference, add coins Unique constraints on your top-up reference and on the provider's payment reference, plus one database transaction that marks the order delivered and adds the coins together, turn a race between the callback and the reconciliation job into a harmless duplicate. Also check that a status answer names the order you asked about, and hold any paid result that has no provider reference.
6. Pay hosts and sellers without paying twice
If your app pays creators, hosts or sellers, the same wallets work in the other direction. The rules flip, though: a duplicate top-up gives away coins, while a duplicate payout loses real money.
- Reserve the balance before calling the provider.
- Send the payout with your own reference as the idempotency key.
- On a timeout, query that reference. If the provider has it, wait for the final status. If it does not, let a person approve any replacement.
- On a final failure, release the reservation.
- On any other error, keep the balance reserved and check the reference before doing anything else.
7. Keep settlement separate in your head and in your code
A wallet payment is a local BDT transaction between the customer and the provider's wallet merchant. How funds then reach your company is a separate agreement with your provider. Model it as a separate ledger: top-ups and payouts on one side, provider settlement reports on the other, reconciled daily.
Launch tests
Before going live, make sure these pass:
-
+880 1712-345678and01712345678become the same customer. - The same paid callback three times: coins delivered once.
- Approval after your countdown ended: coins still delivered.
- Callback lost: the status query recovers it.
- Payout request times out: a query, not a second payout.
All five, and nine more, are in the companion repository.
Write the checkout instructions in Bangla and English, tell the customer where the code will arrive, and give support a way to search by top-up reference. Those three things can reduce support tickets noticeably.
Disclosure
I work at PAYJN, which connects bKash, Nagad and Upay collections and payouts for international businesses serving Bangladesh, along with other South and Southeast Asian markets. The checklist applies whichever provider you use. If you are an overseas company planning a launch, our guide on accepting bKash, Nagad and Upay as an overseas business covers the commercial side.