Mobile Recharge API in Bangladesh: A Complete Integration Guide
If you are running a shop app, an e-commerce site with a top-up feature, or a bulk recharge tool, doing it by hand stops working quickly. A recharge API turns each sale into one HTTP request.
The IP whitelist catches most people. A key that works from your laptop will be refused from your production server until that address is added.
| Purpose | Endpoint |
|---|---|
| Send a recharge | POST /sendapi/request |
| Check status | POST /sendapi/status |
| Read balance | POST /sendapi/balance |
| Operator | Code | Prefixes |
|---|---|---|
| Grameenphone | GP | 017, 013 |
| Robi | RB | 018 |
| Banglalink | BL | 019, 014 |
| Airtel | AT | 016 |
| Teletalk | TT | 015 |
| Skitto | SK | 017 |
Skitto numbers use GP prefixes but need their own code — sending them as GP is the single most common integration bug.
<?php
$post = [
'user' => '01XXXXXXXXX',
'key' => 'your_api_key',
'number' => '017XXXXXXXX',
'amount' => '50',
'service' => '64',
'type' => '1', // 1 prepaid, 2 postpaid
'operator' => 'GP',
'id' => 'BD' . date('dmyHis') . mt_rand(100, 999),
];
$ch = curl_init('https://yourdomain.com/sendapi/request');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['band-key: yourbandkey'],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$res = json_decode(curl_exec($ch), true);
You generate it, you store it, and it is how you find the transaction later. Make it unique per request and save it against your order before you send. If the request times out you still know what to look up.
{"success": true, "status": 1, "message": "Request Submit Successfully"}
This means accepted, not completed. The operator has not been contacted yet. Recharges settle anywhere from two seconds to two minutes later. Show your customer "processing", never "done".
Two options.
Call /sendapi/status every few seconds until it stops being pending. Simple, wasteful, and slow for the customer.
Register a URL and receive one signed POST the moment the outcome is known. One request instead of twenty-four, and the customer sees the result immediately. Use this if it is available.
const body = new URLSearchParams({
user: '01XXXXXXXXX', key: 'your_api_key',
number: '017XXXXXXXX', amount: '50',
service: '64', type: '1', operator: 'GP',
id: 'BD' + Date.now()
});
const res = await fetch('https://yourdomain.com/sendapi/request', {
method: 'POST',
headers: { 'band-key': 'yourbandkey' },
body
});
console.log(await res.json());
import requests, time
r = requests.post('https://yourdomain.com/sendapi/request',
headers={'band-key': 'yourbandkey'},
data={'user':'01XXXXXXXXX','key':'your_api_key',
'number':'017XXXXXXXX','amount':'50','service':'64',
'type':'1','operator':'GP',
'id':'BD'+str(int(time.time()*1000))},
timeout=30)
print(r.json())