16Pay Developer Documentation

Everything you need to connect 16Pay to your business.

Use these guides, API references and sample requests to create payment links, verify transactions and connect your website or application with 16Pay Payment Gateway.

Welcome to 16Pay Docs Developer reference

16Pay helps merchants accept payments through configured payment methods and merchant accounts. Customers are redirected securely to complete their payment, and once the payment is finished, your website receives the status and transaction details for further processing.

Introduction

Understand how 16Pay works, what information you need, and how the payment flow connects your website to the gateway.

API Reference

Find API endpoints, headers, parameters and response details for payment creation and payment verification.

Integration Guides

Use sample requests, code snippets and verify calls to integrate your PHP, Laravel, WordPress or other applications.

API Reference

16Pay supports secure REST API calls for payment creation and payment verification. Use your API-KEY, SECRET-KEY and BRAND-KEY in the request headers to authenticate requests.

API Endpoints

Use the create endpoint to generate a payment link for your customer, and the verify endpoint to confirm a transaction after payment completion.

Create Payment URL

https://pay.16bazar.com/api/payment/create

Verify Payment

https://pay.16bazar.com/api/payment/verify
Your server should support cURL or any HTTP client. During testing, use your test credentials. For production, switch to live credentials and live merchant configuration.

Parameters & Headers

Required fields for creating a payment URL

Field Name Description Required Example Value
cus_nameCustomer full nameYesJohn Doe
cus_emailEmail address of the customerYesjohn@gmail.com
amountThe total amount payableYes10 or 10.50
success_urlWhere the customer will return after successful paymentYeshttps://yourdomain.com/success
cancel_urlWhere the customer will return if the payment is cancelled or failsYeshttps://yourdomain.com/cancel
metadataOptional JSON formatted additional dataNo{"phone":"016****"}

Required field for payment verification

Field Name Description Required Example Value
transaction_idTransaction ID received after payment completionYesOVKPXW165414

Required headers

Header Name Value
Content-Typeapplication/json
API-KEYApp key from API credentials
SECRET-KEYSecret key from API credentials
BRAND-KEYBrand key from Brands

Integration Guides

Use the examples below to generate a payment URL and then verify the transaction status from your website or application.

Sample Requests

Review payment creation examples with PHP, Guzzle, Node.js, Python and Native code samples.

Verify Payments

Use the verify endpoint to fetch transaction details and confirm the final payment status.

Sample Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://pay.16bazar.com/api/payment/create', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{"success_url":"yourdomain.com/success","cancel_url":"yourdomain.com/cancel","metadata":{"phone":"016****"},"amount":"10"}', CURLOPT_HTTPHEADER => array( 'API-KEY: your_api_key', 'Content-Type: application/json', 'SECRET-KEY: YourSecretKeyHere', 'BRAND-KEY: YourBrandKeyHere' ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
<?php
$client = new Client();
$headers = [ 'API-KEY' => 'your_api_key', 'Content-Type' => 'application/json', 'SECRET-KEY' => 'YourSecretKeyHere', 'BRAND-KEY' => 'YourBrandKeyHere'
];
$body = '{ "success_url": "yourdomain.com/success", "cancel_url": "yourdomain.com/cancel", "metadata": { "phone": "016****" }, "amount": "10"
}';
$request = new Request('POST', 'https://pay.16bazar.com/api/payment/create', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
const axios = require('axios');
let data = JSON.stringify({ "success_url": "yourdomain.com/success", "cancel_url": "yourdomain.com/cancel", "metadata": { "phone": "016****" }, "amount": "10"
});
let config = { method: 'post', maxBodyLength: Infinity, url: 'https://pay.16bazar.com/api/payment/create', headers: { 'API-KEY': 'your_api_key', 'Content-Type': 'application/json', 'SECRET-KEY': 'YourSecretKeyHere', 'BRAND-KEY': 'YourBrandKeyHere' }, data: data
};
axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); });
import requests
url = "https://pay.16bazar.com/api/payment/create"
payload = { "success_url": "yourdomain.com/success", "cancel_url": "yourdomain.com/cancel", "metadata": {"phone": "016****"}, "amount": "10"
}
headers = { "API-KEY": "your_api_key", "SECRET-KEY": "YourSecretKeyHere", "BRAND-KEY": "YourBrandKeyHere", "Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
POST https://pay.16bazar.com/api/payment/create
Headers:
API-KEY: your_api_key
SECRET-KEY: YourSecretKeyHere
BRAND-KEY: YourBrandKeyHere
Content-Type: application/json
Body:
{ "success_url": "yourdomain.com/success", "cancel_url": "yourdomain.com/cancel", "metadata": { "phone": "016****" }, "amount": "10"
}
After the payment link is generated successfully, redirect your customer to the returned payment_url so they can complete payment.
Sample Response
{ "status": true, "message": "Payment URL created successfully", "payment_url": "https://gateway.example.com/pay/ABCDEF123"
}

Response Details

Field Name Type Description
Success Response
statusboolTRUE
messagestringMessage for status
payment_urlstringPayment link where customers complete payment
Error Response
statusboolFALSE
messagestringMessage associated with the error response
After the payment page task is completed, your success or cancel URL may receive parameters like:
transactionId, paymentMethod, paymentAmount, paymentFee and status.
Verify Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://pay.16bazar.com/api/payment/verify', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{"transaction_id":"ABCDEFH"}', CURLOPT_HTTPHEADER => array( 'API-KEY: your_api_key', 'Content-Type: application/json', 'SECRET-KEY: Secret key From API credentials', 'BRAND-KEY: Brand key From Brands' ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
<?php
$client = new Client();
$headers = [ 'API-KEY' => 'your_api_key', 'Content-Type' => 'application/json', 'SECRET-KEY' => 'Secret key From API credentials', 'BRAND-KEY' => 'Brand key From Brands'
];
$body = '{ "transaction_id": "ABCDEFH"
}';
$request = new Request('POST', 'https://pay.16bazar.com/api/payment/verify', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
const axios = require('axios');
let data = JSON.stringify({ "transaction_id": "ABCDEFH"
});
let config = { method: 'post', maxBodyLength: Infinity, url: 'https://pay.16bazar.com/api/payment/verify', headers: { 'API-KEY': 'your_api_key', 'Content-Type': 'application/json', 'SECRET-KEY': 'Secret key From API credentials', 'BRAND-KEY': 'Brand key From Brands' }, data: data
};
axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); });
import requests
url = "https://pay.16bazar.com/api/payment/verify"
payload = { "transaction_id": "ABCDEFH"
}
headers = { "API-KEY": "your_api_key", "SECRET-KEY": "Secret key From API credentials", "BRAND-KEY": "Brand key From Brands", "Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
POST https://pay.16bazar.com/api/payment/verify
Headers:
API-KEY: your_api_key
SECRET-KEY: Secret key From API credentials
BRAND-KEY: Brand key From Brands
Content-Type: application/json
Body:
{ "transaction_id": "ABCDEFH"
}
Sample Response
{ "cus_name": "John Doe", "cus_email": "john@gmail.com", "amount": "900.000", "transaction_id": "OVKPXW165414", "metadata": { "phone": "015****" }, "payment_method": "bkash", "status": "COMPLETED"
}

Response Details

Field Name Type Description
Success Response
statusstringCOMPLETED or PENDING or ERROR
cus_namestringCustomer name
cus_emailstringCustomer email
amountstringAmount
transaction_idstringTransaction ID generated by the system
metadataobjectCustom metadata passed while creating the payment
payment_methodstringMethod used by the customer

Plugins & Device App

Download ready-made modules and the Android device app to speed up implementation and payment verification.

WordPress Plugin

Connect 16Pay to your WordPress or WooCommerce website with a ready-made plugin package.

Download Plugin

WHMCS Module

Accept payments inside your WHMCS billing portal and manage invoice-related payment flows more easily.

Download Module

SMM Panel Module

Use the SMM module to integrate payment collection into your social media marketing panel or service site.

Download Module

Device App

Download the Android device app and connect it with your live API keys to support payment verification workflows.

Download Device App