Logo Adhunik Pay Docs

REST API Documentation

Seamlessly integrate automated bKash, Nagad, and Rocket payments into any web application or eCommerce platform.

Quick Integration Workflow:
1. Register an account and top up your balance via Add Fund.
2. Activate an active subscription package from Packages.
3. Whitelist your eCommerce domain under Domains and sync your Rider App under Devices.
4. Implement the cURL integration snippets below to initiate checkouts!

1. Authentication & API Credentials

All API calls require your secret credentials passed in the JSON payload or request parameters.

Sign in to your merchant dashboard to view your live personal API keys. Sign in now →

2. Create Payment Request

Send an HTTP POST request to initialize a payment checkout session. This endpoint returns a secured invoice and a unique payment_url.

POST https://adhunikpay.site/api/payment.php
Field Type Requirement Description
api_key string Required Your live merchant public API Key
amount float Required Payable amount in BDT (e.g. 500.00)
customer_name string Optional Customer's full name
customer_phone string Optional Customer's mobile phone number
callback_url url Required Webhook endpoint receiving instant payment notifications
success_url url Optional Redirection page upon successful checkout
Sample JSON Response:
{
    "status": "success",
    "message": "Payment session initialized successfully.",
    "invoice_id": "APAY_4F7A9B123C",
    "payment_url": "https://adhunikpay.site/payment/index.php?invoice=APAY_4F7A9B123C",
    "amount": "500.00",
    "currency": "BDT",
    "expires_at": "2026-10-30 18:45:00"
}

3. Query Payment Status

Verify the real-time status of an invoice manually by issuing a GET request.

GET https://adhunikpay.site/api/status.php?api_key={YOUR_KEY}&invoice_id={INVOICE_ID}
Sample JSON Response:
{
    "status": "success",
    "invoice_id": "APAY_4F7A9B123C",
    "payment_status": "completed",
    "amount": 500,
    "currency": "BDT",
    "payment_method": "bKash",
    "transaction_id": "BLG74H92KX",
    "created_at": "2026-10-30 18:30:00"
}

4. Real-Time Webhook Callback

As soon as an incoming payment is matched and verified by the Rider App, our engine delivers an HTTP POST callback to your configured callback_url:

{
    "event": "payment.success",
    "invoice_id": "APAY_4F7A9B123C",
    "amount": 500,
    "currency": "BDT",
    "transaction_id": "BLG74H92KX",
    "customer_name": "Nayeem",
    "customer_phone": "01700000000",
    "timestamp": 1774880500
}

5. PHP Merchant Checkout Implementation (checkout.php)

Use the sample script below to trigger checkouts from your eCommerce button:

<?php
/**
 * Adhunik Pay - Merchant Checkout Sample
 * File: checkout.php
 */

$apiKey = 'YOUR_ADHUNIK_PAY_API_KEY';
$apiUrl = 'https://adhunikpay.site/api/payment.php';

// Prepare transaction payload
$postData = [
    'api_key'        => $apiKey,
    'amount'         => 500.00,
    'customer_name'  => 'Nayeem',
    'customer_phone' => '01700000000',
    'callback_url'   => 'https://' . ($_SERVER['HTTP_HOST'] ?? 'yourdomain.com') . '/webhook.php',
    'success_url'    => 'https://' . ($_SERVER['HTTP_HOST'] ?? 'yourdomain.com') . '/success.php',
    'cancel_url'     => 'https://' . ($_SERVER['HTTP_HOST'] ?? 'yourdomain.com') . '/cancel.php'
];

$ch = curl_init($apiUrl);
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode($postData),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json']
]);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);

if (!empty($result['status']) && $result['status'] === 'success') {
    // Redirect customer directly to the automated payment gateway
    header('Location: ' . $result['payment_url']);
    exit;
} else {
    echo 'Unable to initiate payment: ' . ($result['message'] ?? 'Connection error');
}
?>

6. Webhook Listener Implementation (webhook.php)

Deploy this receiver script on your server to confirm orders automatically upon receiving verification webhooks:

<?php
/**
 * Adhunik Pay - Webhook Listener
 * File: webhook.php
 */

header('Content-Type: application/json');

// Read incoming JSON body
$rawPayload = file_get_contents('php://input');
$data = json_decode($rawPayload, true);

if (!$data || empty($data['invoice_id'])) {
    http_response_code(400);
    echo json_encode(['status' => 'bad_request']);
    exit;
}

// Extract transaction data
$invoiceId = $data['invoice_id'];
$trxId     = $data['transaction_id']; // Verified MFS TrxID
$amount    = $data['amount'];

// 1. Update order status in your eCommerce database
// Example: $db->query("UPDATE orders SET status = 'paid', trx_id = '$trxId' WHERE invoice_id = '$invoiceId'");

// 2. Acknowledge delivery to Adhunik Pay engine
http_response_code(200);
echo json_encode(['status' => 'received', 'message' => 'Order fulfilled successfully']);
exit;
?>

Official Downloads & Extensions

Download verified native applications and ready-to-use billing modules for your infrastructure.

SMS Rider App v2.4.0 APK

Background SMS sync client for Android. Automatically syncs payment confirmation SMS from bKash, Nagad, and Rocket.

Download Rider APK

WHMCS Gateway v1.2.0 ZIP

Plug-and-play payment gateway module for WHMCS v8.x+. Supports automated invoice fulfillment and client redirect checkouts.

Download WHMCS Module (.zip)