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()Choose how you want to integrate
Both use the same API key and the same signed webhook.
Web Checkout
We host the payment page
Create a payment link, redirect your customer, then verify. Two API calls and you are done.
Read the Web Checkout guide → Direct APIYou build the payment screen
Get receiver details from the API, show them on your own page, then submit the customer’s TrxID.
Read the Direct API guide →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.
- Create a payment linkSend a POST request to
/api/payment/createwith the amount and your return URLs. - Redirect your customerSend them to the
payment_urlyou receive. They pay on our page. - Verify the paymentWhen they return, call
/api/payment/verifyand deliver when the status isCOMPLETED.
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.