d pay · Public API v1

Mobile Recharge API

Real Public API v1 — Complete specification for authentication, recharge, MFS, packages, balance, and webhooks.

REST · JSON HTTPS TLS 1.3 Bearer Token Auth < 50ms Latency
Instant Integration Call via cURL, PHP, Python, Node.js or Java.
Bearer / X-API-KEY Generate `mtc_live_…` keys from the user panel.
Instant Webhooks Receive instant transaction callback notifications.

Base URL (Production Endpoint)

200 OK
All production API requests must use this Public API v1 base URL (`/api/v1`).
Live Server Content-Type: application/json
https://dpay.im/api/v1

Authentication & Headers

Bearer / Key
Send the same API key either as `Authorization: Bearer` or `X-API-KEY`. Both are accepted.
Authorization: Bearer mtc_live_xxxxxxxx
# or
X-API-KEY: mtc_live_xxxxxxxx
Content-Type: application/json
Accept: application/json

Billing & Wallet Debit

net_payable
On create, reseller rate-card pricing computes `net_payable` and debits the main wallet. Commission/charge rules are configured in the admin panel.
net_payable ≈ amount − commission (+ charge if configured)

# Fail / cancel / timeout → wallet credit (cashback) of the debited amount

HTTP Status Codes & Response Reference

Common HTTP status codes from Public API v1:
Code Status Description
200 OK / SUCCESS Request accepted / completed. TrxID returned.
400 BAD_REQUEST Invalid payload or phone number.
401 UNAUTHORIZED Missing or invalid API key.
402 INSUFFICIENT_BALANCE Reseller wallet balance is insufficient.
403 FORBIDDEN Inactive key or API access facility blocked.

API Sandbox (All Endpoints)

Sandbox
Test recharge, MFS, drive, balance, status & webhook here. Browser demo does not call live API; use `mtc_test_…` keys for real sandbox server responses.
Local demo · no live charge
// Request preview…
// Response…

Sandbox (Test Keys)

Try Sandbox Endpoint
Use keys starting with `mtc_test_` (environment=test).
Works for ALL endpoints: recharge, MFS, drive, balance, status.
No wallet debit and no live USSD/gateway — responses include `"sandbox": true`.
Generate a test key from the user panel API credentials.
curl -X POST "https://dpay.im/api/v1/recharge" \
  -H "Authorization: Bearer mtc_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operator":"gp","recipient":"017XXXXXXXX","amount":50,"request_type":"recharge","client_tx_id":"SBX-1"}'

Mobile Recharge

Try Sandbox Endpoint
POST /recharge — prepaid/postpaid mobile recharge.
Operators: gp, robi, bl, airtel, teletalk, skitto.
Required: operator, recipient, amount, request_type=recharge.
Optional: client_tx_id (idempotency).
curl -X POST "https://dpay.im/api/v1/recharge" \
  -H "Authorization: Bearer mtc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operator":"gp","recipient":"017XXXXXXXX","amount":100,"request_type":"recharge","client_tx_id":"RCH-1001"}'

MFS (bKash / Nagad / Rocket / Upay)

Try Sandbox Endpoint
Same endpoint POST /recharge — use MFS operators + wallet request_type.
Operators: bkash, nagad, rocket, upay.
request_type: send_money | cash_in | cash_out.
Required: operator, recipient, amount, request_type, client_tx_id.
curl -X POST "https://dpay.im/api/v1/recharge" \
  -H "Authorization: Bearer mtc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operator":"bkash","recipient":"017XXXXXXXX","amount":500,"request_type":"send_money","client_tx_id":"MFS-1001"}'

Drive / Data Pack

Try Sandbox Endpoint
Same endpoint POST /recharge — buy operator drive/data packs.
Operators: gp, robi, bl, airtel, teletalk (pack-enabled).
request_type: drive_offer (or regular_pack).
Required: operator, recipient, amount, drive_offer_id (from GET/POST /packages), client_tx_id.
curl -X POST "https://dpay.im/api/v1/recharge" \
  -H "Authorization: Bearer mtc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operator":"robi","recipient":"018XXXXXXXX","amount":399,"request_type":"drive_offer","drive_offer_id":12,"client_tx_id":"DRV-1001"}'

Packages catalog (Drive / Regular / MFS)

Endpoint
POST /packages — list active drive + regular packs and MFS operators.
Use this to sync packages onto a peer/white-label site (API Gateways → MTC Upstream → Sync Packages).
Optional filters: operator, pack_kind=drive_offer|regular_pack.
Auth: same live/test key + IP whitelist.
curl -X POST "https://dpay.im/api/v1/packages" \
  -H "Authorization: Bearer mtc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"include":"drive,regular_pack,mfs"}'

Security (IP Whitelist)

Endpoint
Live keys (mtc_live_) must be created with an IP whitelist.
Only listed IPs/CIDRs can call the API; others get HTTP 403.
Peer sites: whitelist the child server public IP on the parent merchant key.
Test keys (mtc_test_) may omit whitelist for sandbox.
# Generate live key with whitelist in Merchant API management
# Example whitelist: 203.0.113.10, 198.51.100.0/24

Balance

Try Sandbox Endpoint
POST /balance — fetch main / drive / bank wallet balances and commission rates for your reseller level.
curl -X POST "https://dpay.im/api/v1/balance" \
  -H "Authorization: Bearer mtc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Transaction status

Try Sandbox Endpoint
POST /status — poll by transaction_id or client_tx_id until success/failed.
curl -X POST "https://dpay.im/api/v1/status" \
  -H "Authorization: Bearer mtc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"client_tx_id":"RCH-1001"}'

Webhook / Callback

Try Sandbox Endpoint
Configure your callback URL in the panel.
Respond HTTP 200 quickly; process async.
POST /callback can be used for gateway echo tests.
curl -X POST "https://dpay.im/api/v1/callback" \
  -H "Content-Type: application/json" \
  -d '{"event":"transaction.updated","transaction_id":"MTC123","status":"success"}'