Developer documentation

Accept payments with a simple API

Two ways to integrate BG PAY BD: a hosted Web Checkout, or the Direct API where you build the payment screen yourself. Copy a sample in your language and go live in minutes.

POST /api/payment/create
curl -X POST https://bgpaybd.shop/api/payment/create \ -H "API-KEY: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 150, "cus_name": "John Doe", "cus_email": "john@gmail.com", "success_url": "https://yourdomain.com/success", "cancel_url": "https://yourdomain.com/cancel", "webhook_url": "https://yourdomain.com/webhook" }'
<?php$payload = [ 'amount' => 150, 'cus_name' => 'John Doe', 'cus_email' => 'john@gmail.com', 'success_url' => 'https://yourdomain.com/success', 'cancel_url' => 'https://yourdomain.com/cancel', 'webhook_url' => 'https://yourdomain.com/webhook',];$ch = curl_init('https://bgpaybd.shop/api/payment/create');curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_TIMEOUT => 20, CURLOPT_HTTPHEADER => ['API-KEY: YOUR_API_KEY', 'Content-Type: application/json'], CURLOPT_POSTFIELDS => json_encode($payload),]);$response = json_decode(curl_exec($ch), true);curl_close($ch);
const response = await fetch('https://bgpaybd.shop/api/payment/create', { method: 'POST', headers: { 'API-KEY': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ amount: 150, cus_name: 'John Doe', cus_email: 'john@gmail.com', success_url: 'https://yourdomain.com/success', cancel_url: 'https://yourdomain.com/cancel', webhook_url: 'https://yourdomain.com/webhook' }),});const data = await response.json();
import requestsresponse = requests.post( 'https://bgpaybd.shop/api/payment/create', headers={'API-KEY': 'YOUR_API_KEY'}, json={ 'amount': 150, 'cus_name': 'John Doe', 'cus_email': 'john@gmail.com', 'success_url': 'https://yourdomain.com/success', 'cancel_url': 'https://yourdomain.com/cancel', 'webhook_url': 'https://yourdomain.com/webhook', }, timeout=20,)data = response.json()

Why developers like it

Everything you need to take payments safely.

Server to serverYour API key stays on your server and never touches the browser.
Idempotent requestsRetry safely. The same key never creates a second payment.
Signed webhooksHMAC-SHA256 signatures so you can trust every notification.
9 code samplescURL, PHP, Laravel, WordPress, Node.js, Python, Java, C# and Go.

Quick start

The shortest path with Web Checkout.

  1. Create a payment linkSend a POST request to /api/payment/create with the amount and your return URLs.
  2. Redirect your customerSend them to the payment_url you receive. They pay on our page.
  3. Verify the paymentWhen they return, call /api/payment/verify and deliver when the status is COMPLETED.
200 OK
{ "status": 1, "message": "Payment Link", "payment_url": "https://bgpaybd.shop/payment/ABC1234"}

Ready to take payments with BG PAY BD?

Read the full documentation and add payments to your product today.

Open the docs