Developer Documentation

Ready to take payments using BD Secure Pay

Accept payments from your customer's mobile wallet or card, straight into your own BD Secure Pay account, using a REST API built for developers.

2REST endpoints
5Language examples
6Ready-made modules
Introduction

What BD Secure Pay is and how the redirect-based payment flow works end to end.

APIs

Two REST endpoints — create a payment link, then verify the result.

Integration

Copy-paste examples for PHP, Node, Python and Go.

Mobile App

Track live transactions on the go with the BD Secure Pay Android app.

Welcome to BD Secure Pay Docs Last updated: 2024-06-06

BD Secure Pay is a simple and secure payment automation tool which is designed to use a personal account as a payment gateway, so you can accept payments from your customers through your website. Below you'll find a complete overview of how BD Secure Pay works and how to integrate the BD Secure Pay API into your website.

API Introduction

BD Secure Pay Payment Gateway enables merchants to receive money from customers by temporarily redirecting them to www.BD Secure Pay.com. The gateway connects to multiple payment terminals including card systems, mobile financial services, and local & international wallets. After a payment completes, the customer returns to your site, and moments later you receive a notification with the transaction details.

API Operation

REST APIs are supported in two environments. Use the Sandbox environment for testing, then switch to Live for production. Your server needs cURL support; an HTML form-post method is also available if you'd rather not use cURL.

POST https://payment.bdpayment.online/api/payment/create creates a payment link
POST https://payment.bdpayment.online/api/payment/verify verifies a transaction

Parameter Details

Fields to POST when creating a payment

FieldDescriptionRequiredExample
cus_nameCustomer's full nameRequiredJohn Doe
cus_emailCustomer's email addressRequiredjohn@gmail.com
amountTotal payable amount. Skip trailing zeros for whole numbers.Required10 or 10.50
success_urlWhere the customer returns after a successful paymentRequiredhttps://yourdomain.com/success.php
cancel_urlWhere the customer returns if they cancelRequiredhttps://yourdomain.com/cancel.php
meta_dataAny JSON-formatted data you want echoed backOptionalJSON formatted

Fields needed for payment verification

FieldDescriptionRequiredExample
transaction_idReceived as a query parameter on your success URLRequiredOVKPXW165414

Headers

HeaderValue
Content-Typeapplication/json
API-KEYYour app key, from API credentials

Integration

Integrate BD Secure Pay into your PHP, Laravel, WordPress or WooCommerce site in three steps.

1

Create a Payment

POST https://payment.bdpayment.online/api/payment/create
<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://payment.bdpayment.online/api/payment/create',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode([
    "cus_name" => "John Doe",
    "cus_email" => "john@gmail.com",
    "amount" => "10",
    "success_url" => "https://yourdomain.com/success",
    "cancel_url" => "https://yourdomain.com/cancel"
  ]),
  CURLOPT_HTTPHEADER => array(
    'API-KEY: gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef',
    'Content-Type: application/json'
  ),
));

$response = json_decode(curl_exec($curl), true);
curl_close($curl);

if ($response['status']) {
    header('Location: ' . $response['payment_url']);
    exit();
}
echo $response['message'];
<?php
$client = new GuzzleHttp\Client();
$headers = [
  'API-KEY' => 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef',
  'Content-Type' => 'application/json'
];
$body = json_encode([
  "cus_name" => "John Doe",
  "cus_email" => "john@gmail.com",
  "amount" => "10",
  "success_url" => "https://yourdomain.com/success",
  "cancel_url" => "https://yourdomain.com/cancel"
]);
$request = new GuzzleHttp\Psr7\Request('POST', 'https://payment.bdpayment.online/api/payment/create', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const axios = require('axios');

const data = JSON.stringify({
  cus_name: "John Doe",
  cus_email: "john@gmail.com",
  amount: "10",
  success_url: "https://yourdomain.com/success",
  cancel_url: "https://yourdomain.com/cancel"
});

axios.post('https://payment.bdpayment.online/api/payment/create', data, {
  headers: {
    'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef',
    'Content-Type': 'application/json'
  }
}).then(res => console.log(res.data))
  .catch(err => console.log(err));
import requests, json

url = "https://payment.bdpayment.online/api/payment/create"
payload = json.dumps({
  "cus_name": "John Doe",
  "cus_email": "john@gmail.com",
  "amount": "10",
  "success_url": "https://yourdomain.com/success",
  "cancel_url": "https://yourdomain.com/cancel"
})
headers = {
  'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef',
  'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://payment.bdpayment.online/api/payment/create"
  payload := strings.NewReader(`{"cus_name":"John Doe","cus_email":"john@gmail.com","amount":"10","success_url":"https://yourdomain.com/success","cancel_url":"https://yourdomain.com/cancel"}`)

  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("API-KEY", "gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef")
  req.Header.Add("Content-Type", "application/json")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)
  fmt.Println(string(body))
}
Success Response
{
  "status": true,
  "payment_url": "https://payment.bdpayment.online/invoice/XXXXXXXXXXXX"
}

Redirect your customer to the returned payment_url to complete payment.

2

Redirect & Wait for Completion

Once redirected, the customer completes payment on BD Secure Pay's hosted checkout page. They are then sent back to your success_url or cancel_url with a transactionId query parameter attached.

3

Verify Payment

POST https://payment.bdpayment.online/api/payment/verify

After payment, verify the transaction using the transactionId received via the success URL query parameter.

<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://payment.bdpayment.online/api/payment/verify',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode(["transaction_id" => $_REQUEST['transactionId']]),
  CURLOPT_HTTPHEADER => array(
    'API-KEY: gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new GuzzleHttp\Client();
$headers = ['API-KEY' => 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type' => 'application/json'];
$body = json_encode(["transaction_id" => $_REQUEST['transactionId']]);
$request = new GuzzleHttp\Psr7\Request('POST', 'https://payment.bdpayment.online/api/payment/verify', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const axios = require('axios');

axios.post('https://payment.bdpayment.online/api/payment/verify',
  { transaction_id: req.query.transactionId },
  { headers: { 'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type': 'application/json' } }
).then(res => console.log(res.data));
import requests, json

url = "https://payment.bdpayment.online/api/payment/verify"
payload = json.dumps({"transaction_id": transaction_id})
headers = {'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type': 'application/json'}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://payment.bdpayment.online/api/payment/verify"
  payload := strings.NewReader(`{"transaction_id":"` + transactionId + `"}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("API-KEY", "gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)
  fmt.Println(string(body))
}
Success Response
{
  "status": "COMPLETED",
  "transaction_id": "OVKPXW165414",
  "amount": "500.00",
  "cus_name": "John Doe",
  "cus_email": "john@example.com"
}
Always verify payment server-side before fulfilling orders. Never trust only the success_url redirect.

Ready-Made Modules

Drop-in plugins so you don't have to touch a single line of API code.

WordPress Plugin

Accept payments on any WordPress site — stores, memberships or donation pages.

Download

WHMCS Module

Accept payments, manage invoices and track transactions inside WHMCS.

Download

SMM Panel Gateway

Plug straight into your SMM panel checkout flow.

Download

Perfect SMM Panel Gateway

The same seamless checkout, built for Perfect SMM Panel.

Download

Mobile App

Track and verify every live transaction from your Android device.

Download App

Sketchware SWB

A ready Sketchware project file for building your own app on top of BD Secure Pay.

Download