BDAutoPay API Docs REST v1.0

Automated bKash, Nagad, Rocket & Upay payment integration guide.

Accept instant payments via bKash, Nagad, Rocket, and Upay with automated TrxID verification and real-time webhook notifications.

Base URL: https://bdautopay.com/api/v1
Quickstart in 4 Steps
1. Get API Key

Add your domain in Dashboard → Domains to get your X-API-KEY.

2. Create Payment

POST order data to /payments/create and redirect to payment_url.

3. Customer Pays

Customer pays via MFS and submits TrxID for automatic verification.

4. Instant Webhook

Receive real-time POST callback at your webhook_url upon payment.

Authentication
HEADER Request Headers

Pass your domain's API Key in the request headers over HTTPS.

Header Value Req Description
X-API-KEY YOUR_API_KEY YES Domain API Key from dashboard.
Content-Type application/json YES JSON encoded request body.
Accept application/json YES JSON response format.
Also supports Authorization: Bearer YOUR_API_KEY.

Create Payment
POST https://bdautopay.com/api/v1/payments/create
Request Parameters

Initialize a checkout session and get the payment URL.

Field Type Req Description
amount number YES Payment amount (e.g. 500)
success_url string YES Redirect URL after payment
cancel_url string YES Redirect URL on cancel
title string OPT Order title (e.g. Order #1042)
customer_name string OPT Customer name
customer_email string OPT Customer email
webhook_url string OPT Callback IPN URL
metadata object OPT Custom JSON data (e.g. {"order_id":1042})
<?php
$apiKey = "YOUR_API_KEY";
$apiUrl = "https://bdautopay.com/api/v1/payments/create";

$postData = [
    "amount"         => 500.00,
    "title"          => "Order #1042",
    "customer_name"  => "Rahim Ahmed",
    "customer_email" => "rahim@example.com",
    "success_url"    => "https://yourdomain.com/payment/success",
    "cancel_url"     => "https://yourdomain.com/payment/cancel",
    "webhook_url"    => "https://yourdomain.com/payment/webhook",
    "metadata"       => ["order_id" => "1042"]
];

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-API-KEY: " . $apiKey,
    "Content-Type: application/json",
    "Accept: application/json"
]);

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

$result = json_decode($response, true);
if (!empty($result['status']) && !empty($result['payment_url'])) {
    header("Location: " . $result['payment_url']);
    exit;
} else {
    echo "Error: " . ($result['message'] ?? 'Failed');
}
?>
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;

$client = new Client();
$response = $client->post('https://bdautopay.com/api/v1/payments/create', [
    'headers' => [
        'X-API-KEY'    => 'YOUR_API_KEY',
        'Content-Type' => 'application/json',
        'Accept'       => 'application/json'
    ],
    'json' => [
        'amount'         => 500.00,
        'title'          => 'Order #1042',
        'customer_name'  => 'Rahim Ahmed',
        'customer_email' => 'rahim@example.com',
        'success_url'    => 'https://yourdomain.com/payment/success',
        'cancel_url'     => 'https://yourdomain.com/payment/cancel',
        'webhook_url'    => 'https://yourdomain.com/payment/webhook',
        'metadata'       => ['order_id' => '1042']
    ]
]);

$data = json_decode($response->getBody(), true);
if ($data['status'] === 1) {
    header('Location: ' . $data['payment_url']);
    exit;
}
?>
const response = await fetch("https://bdautopay.com/api/v1/payments/create", {
  method: "POST",
  headers: {
    "X-API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify({
    amount: 500.00,
    title: "Order #1042",
    customer_name: "Rahim Ahmed",
    customer_email: "rahim@example.com",
    success_url: "https://yourdomain.com/payment/success",
    cancel_url: "https://yourdomain.com/payment/cancel",
    webhook_url: "https://yourdomain.com/payment/webhook",
    metadata: { order_id: "1042" }
  })
});

const data = await response.json();
if (data.status === 1) {
  console.log("Redirect to:", data.payment_url);
}
import requests

response = requests.post(
    "api.https://bdautopay.com/api/v1/payments/create",
    headers={
        "X-API-KEY": "YOUR_API_KEY",
        "Content-Type": "application/json",
        "Accept": "application/json"
    },
    json={
        "amount": 500.00,
        "title": "Order #1042",
        "customer_name": "Rahim Ahmed",
        "customer_email": "rahim@example.com",
        "success_url": "https://yourdomain.com/payment/success",
        "cancel_url": "https://yourdomain.com/payment/cancel",
        "webhook_url": "https://yourdomain.com/payment/webhook",
        "metadata": {"order_id": "1042"}
    }
)

data = response.json()
if data.get("status") == 1:
    print("Payment URL:", data["payment_url"])
curl -X POST "https://bdautopay.com/api/v1/payments/create" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "amount": 500.00,
    "title": "Order #1042",
    "customer_name": "Rahim Ahmed",
    "customer_email": "rahim@example.com",
    "success_url": "https://yourdomain.com/payment/success",
    "cancel_url": "https://yourdomain.com/payment/cancel",
    "webhook_url": "https://yourdomain.com/payment/webhook",
    "metadata": {"order_id": "1042"}
  }'
HTTP 201 — Success Response
{
  "status": 1,
  "success": true,
  "message": "Payment Link",
  "payment_url": "https://bdautopay.com/checkout/pay/64_char_token",
  "session_token": "a1b2c3d4e5f67890...",
  "invoice_id": "ABC123XYZ456",
  "amount": "500.00",
  "fee": "0.00",
  "total_amount": "500.00",
  "currency": "BDT"
}

Verify Payment
POST https://bdautopay.com/api/v1/payments/verify
Success Redirect URL Parameters: https://yourdomain.com/success?invoice_id=ABC123XYZ456&status=completed&amount=500.00&trx_id=BLX8921JK
Request Parameter
Field Type Req Description
invoice_id string YES Invoice ID from create or redirect URL.
Response Fields
FieldTypeDescription
verifiedbooleantrue if payment is completed
statusstringcompleted or pending
invoice_idstringUnique Invoice ID
payment_methodstringbkash, nagad, rocket, upay
trx_idstringOperator Transaction ID
total_amountstringTotal paid amount
<?php
$invoiceId = $_GET['invoice_id'] ?? 'ABC123XYZ456';

$ch = curl_init("https://bdautopay.com/api/v1/payments/verify");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["invoice_id" => $invoiceId]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-API-KEY: YOUR_API_KEY",
    "Content-Type: application/json",
    "Accept: application/json"
]);

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

$data = json_decode($response, true);
if (!empty($data['verified']) && $data['status'] === 'completed') {
    echo "Verified! TrxID: " . $data['trx_id'];
}
?>
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;

$client = new Client();
$response = $client->post('https://bdautopay.com/api/v1/payments/verify', [
    'headers' => [
        'X-API-KEY'    => 'YOUR_API_KEY',
        'Content-Type' => 'application/json',
        'Accept'       => 'application/json'
    ],
    'json' => ['invoice_id' => 'ABC123XYZ456']
]);

$data = json_decode($response->getBody(), true);
if ($data['verified'] === true) {
    echo "Paid via " . $data['payment_method'];
}
?>
const res = await fetch("https://bdautopay.com/api/v1/payments/verify", {
  method: "POST",
  headers: {
    "X-API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify({ invoice_id: "ABC123XYZ456" })
});

const data = await res.json();
if (data.verified && data.status === "completed") {
  console.log("Verified! TrxID:", data.trx_id);
}
import requests

res = requests.post(
    "https://bdautopay.com/api/v1/payments/verify",
    json={"invoice_id": "ABC123XYZ456"},
    headers={
        "X-API-KEY": "YOUR_API_KEY",
        "Content-Type": "application/json",
        "Accept": "application/json"
    }
)

data = res.json()
if data.get("verified"):
    print("Verified TrxID:", data["trx_id"])
curl -X POST "https://bdautopay.com/api/v1/payments/verify" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"invoice_id": "ABC123XYZ456"}'
Verification JSON Response
{
  "verified": true,
  "status": "completed",
  "invoice_id": "ABC123XYZ456",
  "payment_method": "bkash",
  "trx_id": "BLX8921JK",
  "amount": "500.00",
  "fee": "0.00",
  "total_amount": "500.00",
  "currency": "BDT",
  "paid_at": "2026-04-13T12:05:00Z"
}

Get Session Status
GET https://bdautopay.com/api/v1/payments/{sessionToken}

Check real-time payment session status using the 64-character sessionToken.

curl -X GET "https://bdautopay.com/api/v1/payments/YOUR_SESSION_TOKEN" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Instant Webhooks (IPN)

On payment completion, BDAutoPay sends an instant HTTP POST payload to your webhook_url.

HEADERS Webhook Headers
HeaderValueDescription
X-API-KEYYOUR_API_KEYYour Domain API Key for verification
X-WEBHOOK-EVENTpayment.completedWebhook event type
Content-Typeapplication/jsonJSON payload
Webhook JSON Payload
{
  "event": "payment.completed",
  "invoice_id": "ABC123XYZ456",
  "status": "completed",
  "payment_method": "bkash",
  "trx_id": "BLX8921JK",
  "sender_number": "017XXXXXXXX",
  "amount": "500.00",
  "total_amount": "500.00",
  "currency": "BDT",
  "metadata": { "order_id": "1042" },
  "paid_at": "2026-04-13T12:05:00Z"
}
Verify & Handle Webhooks

Verify the incoming X-API-KEY header against your API Key and return HTTP 200.

<?php
$myApiKey = "YOUR_API_KEY";
$incomingKey = $_SERVER['HTTP_X_API_KEY'] ?? '';

if (!hash_equals($myApiKey, $incomingKey)) {
    http_response_code(401);
    exit("Unauthorized");
}

$payload = json_decode(file_get_contents("php://input"), true);

if (($payload['status'] ?? '') === 'completed') {
    $invoiceId = $payload['invoice_id'];
    $trxId     = $payload['trx_id'];
    // Update order status in database
}

http_response_code(200);
echo json_encode(["status" => "success"]);
?>
app.post('/webhook', (req, res) => {
  if (req.headers['x-api-key'] !== "YOUR_API_KEY") {
    return res.status(401).json({ error: "Unauthorized" });
  }

  const { status, invoice_id, trx_id } = req.body;
  if (status === 'completed') {
    // Fulfill order in database
  }

  res.status(200).json({ status: "success" });
});
@app.route('/webhook', methods=['POST'])
def handle_webhook():
    if request.headers.get('X-API-KEY') != "YOUR_API_KEY":
        return jsonify({"error": "Unauthorized"}), 401

    payload = request.get_json() or {}
    if payload.get("status") == "completed":
        # Fulfill order in database
        pass

    return jsonify({"status": "success"}), 200

Plugins & SDKs

Ready-made plugins and SDKs for quick integration.