Bohudur PHP Integration Guide
This guide walks you through integrating the Bohudur payment gateway using PHP.
Download bohudur.php
file.
Download bohudur.php
Download php-sample.zip
file.
Download Sample File
Step 1: Include the Bohudur Library
define ('BOHUDUR' , true );
require 'bohudur.php' ;
Step 2: Initialize Bohudur
$bohudur = new Bohudur ("YOUR_API_KEY" );
Step 3: Create a Payment Request
Create create.php
:
define (
'BOHUDUR' ,
true );
require 'bohudur.php' ;
$bohudur =
new Bohudur (
"YOUR_API_KEY" );
$data = [
'fullname' =>
'Jane Doe' ,
'email' =>
'[email protected] ' ,
'amount' =>
100 ,
'return_type' =>
'GET' ,
'currency' =>
'BDT' ,
'redirect_url' =>
'http://yourdomain.com/callback.php' ,
'cancelled_url' =>
'http://yourdomain.com/cancelled.php'
];
$response = $bohudur->
sendRequest ($data);
if (
isset ($response[
'payment_url' ])) {
header (
'Location: ' . $response[
'payment_url' ]);
exit ;
}
else {
echo $response[
'message' ];
}
Step 4: Handle Callback (Success)
Create callback.php
:
define ('BOHUDUR' , true );
require 'bohudur.php' ;
if (isset ($_GET ['payment_key' ])) {
$paymentkey = $_GET ['payment_key' ];
$bohudur = new Bohudur ("YOUR_API_KEY" );
$response = $bohudur->executePayment ($paymentkey);
if (isset ($response['Status' ]) && $response['Status' ] === 'EXECUTED' ) {
echo json_encode ($response);
} else {
echo $response['message' ];
}
} else {
exit ;
}
Step 5: Handle Cancellation
Create cancelled.php
:
<?php
exit ("Payment Cancelled" );
Step 6: Verify Payment (Optional)
You can verify a payment manually:
$response = $bohudur->verifyPayment ("PAYMENT_KEY" );
echo json_encode ($response);
Important Notes
Once a payment is executed, the same payment key cannot be reused . This prevents multiple visits to the same payment link from being falsely marked as successful.
When a payment is successfully created, the response will be:
{
"responseCode": 200,
"message": "request created successfully",
"status": "success",
"paymentkey": "GlPweYgTvDIPp8vOrsEB",
"payment_url": "https://checkout.bohudur.one/payment/GlPweYgTvDIPp8vOrsEB"
}
If the payment fails to be created, you may receive an error response like:
{
"responseCode": "000",
"message": "payment creating failed",
"status": "failed"
}
Execute / Verify Response (Example)
When a payment is successfully executed or verified, the response will look like this:
{
"Full Name": "Demo",
"Email": "[email protected] ",
"Amount": 10,
"Converted Amount": 10,
"Total Amount": 10,
"Currency": "BDT",
"Currency Value": 1,
"Metadata": "[]",
"Time": "2025-05-21 12:07:53",
"Payment Key": "qIHoHsKVC1IBkRWUE1r0",
"Webhook": "[]",
"MFS": "bkash",
"Method": "Send Money",
"Number": "01700000000",
"Transaction ID": "CETO5L00E8",
"Payment Time": "10/03/2025 10:49",
"Status": "EXECUTED"
}