NICTBD Developer API · v1

Mobile Recharge API

Create a recharge order, retrieve its result with the order ID, and receive signed server-to-server notifications.

02API endpointsOrder + status
10Character order IDGH6BS63JS8
Signed webhooksSuccess / failure
01

API account & authentication

Create an API key in the merchant panel. Every request must include your NICT Store ID, NICT API Key and a signature made using your NICT API Secret.

NICT Store IDX-Store-ID
NICT API KeyX-API-Key
NICT API SecretX-Signature signing

Current server address

https://gigora.com.bdDetected from this website

Required HTTP headers

Accept: application/json
Content-Type: application/json
X-Store-ID: YOUR_NICT_STORE_ID
X-API-Key: YOUR_NICT_API_KEY
X-Timestamp: UNIX_SECONDS
X-Nonce: RANDOM_UNIQUE_STRING_16_TO_80
X-Signature: LOWERCASE_HMAC_SHA256_HEX

Use a different nonce for each request. The timestamp is in seconds, and the accepted time difference is 300 seconds.

Signature formula

body_hash = SHA256_HEX(raw_request_body)
canonical = timestamp + "\n" + nonce + "\n" + METHOD + "\n" + PATH + "\n" + body_hash
signature = HMAC_SHA256_HEX(canonical, NICT_API_SECRET)

METHOD must be uppercase. PATH is the exact URL path without the server address or query string. For GET, the body is empty.

02

Two recharge endpoints

POST
/api/recharge/v1/ordersCreate recharge order

Submit the recipient number, operator, account type and amount. The response contains the order ID.

GET
/api/recharge/v1/orders/{orderRef}Get order status

Use the returned order ID to view the current result at any time.

Operator names and codes

OperatorCodeNumber prefix
GrameenphoneGP013, 017
SkittoGP ST013, 017
BanglalinkBL014, 019
RobiRB018
CirkleAT016
TeletalkTT015
Brilliant ConnectBRI09638, 09658

Select the correct operator for transferred (MNP) numbers. The account type is prepaid or postpaid.

03

Recharge request & PHP example

Example JSON request

{
  "mobile": "017XXXXXXXX",
  "operator": "GP",
  "account_type": "prepaid",
  "amount": "50.00",
  "idempotency_key": "myshop_20261122_000001"
}

The idempotency key must be unique for a new order (16–80 letters, digits, _ or -). If the request times out, retry the same order with the same key.

PHP 8.2 example — create an order

<?php
$baseUrl = 'https://gigora.com.bd';
$path = '/api/recharge/v1/orders';
$storeId = getenv('NICT_STORE_ID');
$apiKey = getenv('NICT_API_KEY');
$apiSecret = getenv('NICT_API_SECRET');
$payload = [
    'mobile' => '017XXXXXXXX',
    'operator' => 'GP',
    'account_type' => 'prepaid',
    'amount' => '50.00',
    'idempotency_key' => 'shop_' . bin2hex(random_bytes(12)),
];
$body = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
$timestamp = (string) time();
$nonce = bin2hex(random_bytes(16));
$canonical = $timestamp . "\n" . $nonce . "\nPOST\n" . $path
    . "\n" . hash('sha256', $body);
$signature = hash_hmac('sha256', $canonical, $apiSecret);
$curl = curl_init($baseUrl . $path);
curl_setopt_array($curl, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 25,
    CURLOPT_HTTPHEADER => [
        'Accept: application/json', 'Content-Type: application/json',
        'X-Store-ID: ' . $storeId, 'X-API-Key: ' . $apiKey,
        'X-Timestamp: ' . $timestamp, 'X-Nonce: ' . $nonce,
        'X-Signature: ' . $signature,
    ],
]);
$response = curl_exec($curl);
if ($response === false) { throw new RuntimeException(curl_error($curl)); }
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
$result = json_decode($response, true);
// Store order_ref from $result; use the SAME idempotency_key on network retries.
var_dump($httpCode, $result);

Check status — PHP example

<?php
$baseUrl = 'https://gigora.com.bd';
$orderId = 'GH6BS63JS8';
$path = '/api/recharge/v1/orders/' . rawurlencode($orderId);
$timestamp = (string)time();
$nonce = bin2hex(random_bytes(16));
$canonical = $timestamp . "\n" . $nonce . "\nGET\n" . $path
    . "\n" . hash('sha256', '');
$signature = hash_hmac('sha256', $canonical, getenv('NICT_API_SECRET'));
$curl = curl_init($baseUrl . $path);
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 25,
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'X-Store-ID: ' . getenv('NICT_STORE_ID'),
        'X-API-Key: ' . getenv('NICT_API_KEY'),
        'X-Timestamp: ' . $timestamp,
        'X-Nonce: ' . $nonce,
        'X-Signature: ' . $signature,
    ],
]);
$response = curl_exec($curl);
if ($response === false) { throw new RuntimeException(curl_error($curl)); }
curl_close($curl);
print_r(json_decode($response, true));
04

Order responses & statuses

POST /api/recharge/v1/orders · HTTP 202

{
  "success": true,
  "order_ref": "GH6BS63JS8",
  "status": "processing",
  "source": "api",
  "amount": "50.00",
  "commission": "0.75",
  "net_cost": "49.25"
}

GET /api/recharge/v1/orders/GH6BS63JS8 · HTTP 200

{
  "success": true,
  "order": {
    "order_ref": "GH6BS63JS8",
    "status": "success",
    "source": "api",
    "operator": "GP",
    "account_type": "prepaid",
    "amount": "50.00",
    "commission": "0.75",
    "net_cost": "49.25",
    "created_at": "2026-11-22 10:00:00",
    "completed_at": "2026-11-22 10:00:15"
  }
}
successfailedprocessingreview

Success and failed are final. Processing and review mean the recharge is not settled yet. The same order ID works for webhooks and status requests.

05

Automatic result webhook

Save your public HTTPS webhook URL under Merchant Panel → API Keys. NICTBD sends a signed event to that URL on confirmed success or failure.

Your server→NICTBD→Recharge result→Your webhook

Webhook request headers

Content-Type: application/json
X-NICT-Event-ID: 6b296810-6034-41ca-a404-d13a673d1e34
X-NICT-Timestamp: 1795320000
X-NICT-Signature: sha256=LOWERCASE_HMAC_SHA256_HEX

The webhook signing secret appears on the API Keys page and is separate from your API Secret. The signature is the HMAC-SHA256 of timestamp + "." + raw JSON body.

Webhook event example

{
  "event_id": "6b296810-6034-41ca-a404-d13a673d1e34",
  "event": "recharge.success",
  "occurred_at": "2026-11-22 10:00:15",
  "data": {
    "order_ref": "GH6BS63JS8",
    "status": "success",
    "source": "api",
    "mobile": "017XXXXXXXX",
    "operator": "GP",
    "account_type": "prepaid",
    "amount": "50.00",
    "commission": "0.75",
    "net_cost": "49.25",
    "wallet_debit": "50.00",
    "transaction_id": "GATEWAY-REFERENCE-OPTIONAL",
    "completed_at": "2026-11-22 10:00:15"
  }
}

PHP webhook signature verification

<?php
$secret = getenv('NICT_WEBHOOK_SECRET');
$raw = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_NICT_TIMESTAMP'] ?? '';
$provided = $_SERVER['HTTP_X_NICT_SIGNATURE'] ?? '';
$eventId = $_SERVER['HTTP_X_NICT_EVENT_ID'] ?? '';
if (!preg_match('/^[0-9]{10}$/D', $timestamp)
    || abs(time()-(int)$timestamp) > 300
    || !preg_match('/^[a-f0-9-]{36}$/D', $eventId)) {
    http_response_code(401); exit;
}
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $raw, $secret);
if (!hash_equals($expected, $provided)) { http_response_code(401); exit; }
$event = json_decode($raw,true);
if (!is_array($event) || ($event['event_id']??'') !== $eventId
    || !in_array(($event['event']??''),['recharge.success','recharge.failed'],true)) {
    http_response_code(400); exit;
}
// Record event_id uniquely before acting; duplicates must not apply twice.
http_response_code(200);
echo 'OK';

Respond with HTTP 2xx after saving the event. Duplicate delivery can occur; identify the event by event_id. If the webhook is delayed, check status with your order ID.

06

Errors & request retries

HTTP statusReasonWhat to do
401Authentication failedCheck credentials and signature
403Merchant not allowedContact support
404Order not foundCheck your order ID
409Repeated request nonceUse a new nonce; keep the original idempotency key on retry
422Invalid input or insufficient balanceCheck details and wallet