Bohudur Laravel SDK Documentation
Developer-first Laravel SDK for the Bohudur Payment Automation Platform.
This package is a Laravel wrapper around the Bohudur Payment API, providing a clean service-based architecture, Facade access, and fluent request builders.
Requirements
| Requirement | Value |
|---|---|
| PHP | ^8.0 |
| Laravel | ^10.x |
| Extensions | curl, json |
Installation
Step 1: Install Package
composer require bohudur/laravel-sdk:^1.1.0Step 2: Configure Environment
Add your credentials to .env:
BOHUDUR_API_KEY=YOUR_API_KEYImportant
Never expose your Bohudur API Key in frontend JavaScript, mobile apps, or public repositories. Always use the Laravel SDK on a secure server.
API Flow Overview (Laravel)
- Create payment
- Redirect customer to hosted checkout
- Customer completes or cancels payment
- Execute payment
- Receive webhook (optional)
- Query payment anytime
This flow is identical to the PHP SDK and cURL API.
Create Payment (Laravel)
Creates a new payment session and returns a hosted checkout URL.
Example
use App\Modules\Bohudur\Facades\Bohudur;
use App\Modules\Bohudur\Exceptions\BohudurException;
try {
$response = Bohudur::request()
->fullName('Jane Doe')
->email('janedoe@gmail.com')
->amount(10)
->returnType('GET')
->redirectUrl('https://example.com/redirect')
->cancelUrl('https://example.com/cancel')
->metadata([
'order_id' => 'ORD-1001',
'user_id' => 55
])
->webhook([
'success' => 'https://example.com/success',
'cancel' => 'https://example.com/cancel'
])
->send();
}catch (BohudurException $e) {
echo $e->getMessage();
}Create Payment Parameters
| Method | Required | Type | Description |
|---|---|---|---|
fullName() | YES | string | Customer full name |
email() | YES | string | Customer email |
amount() | YES | float | Payment amount |
returnType() | YES | string | GET or POST |
redirectUrl() | YES | string | Redirect URL after success |
cancelUrl() | YES | string | Redirect URL after cancellation |
metadata() | NO | array | Custom key-value data |
webhook() | NO | array | Webhook URLs |
Create Payment Response
Success
{
"responseCode": 200,
"message": "Payment created successfully",
"status": "success",
"paymentkey": "5RWS4w2w1R5nFAvoP5U0JS4O74UrMXGt",
"payment_url": "https://checkout.bohudur.one/payment/5RWS4w2w1R5nFAvoP5U0JS4O74UrMXGt"
}Failed
{
"responseCode": 3018,
"message": "Oops! Internal error. Try again",
"status": "failed"
}Response objects are returned as stdClass, allowing direct access like:
$response->responseCode;
$response->payment_url;Redirecting Customer
if ($response->status === 'success') {
return redirect()->away($response->payment_url);
}Execute Payment (Laravel)
Finalizes a completed payment.
Example
$execute = Bohudur::execute('PAYMENT_KEY');Rules
- Can be executed only once
- Payment must be COMPLETED
- Executed payments are final
Execute Response (Success)
{
"full_name": "Gabriel Adams",
"email": "jsondoe@gmail.com",
"amount": 40,
"converted_amount": 4878,
"total_amount": 40,
"transaction_fee": 0,
"default_currency": "USD",
"payment_currency": "BDT",
"currency_value": 121.951,
"metadata": [],
"created_time": "2026-01-04 16:04:35",
"payment_time": "2026-01-04 16:12:37",
"paymentkey": "fnPwIkdIsMjN4FJxYxw6DF75GuW9qStn",
"webhook": [],
"payment_info": {
"m0": "SSLCommerz",
"status": "VALID",
"tran_date": "2026-01-04 16:05:04",
"tran_id": "IGQM_695a3b59h6a9"
},
"status": "EXECUTED"
}Query Payment (Laravel)
Retrieve payment information at any time.
Example
$query = Bohudur::query('PAYMENT_KEY');Query Payment Status
Success Response
{
"full_name": "Gabriel Adams",
"email": "jsondoe@gmail.com",
"amount": 40,
"converted_amount": 4878,
"total_amount": 40,
"transaction_fee": 0,
"default_currency": "USD",
"payment_currency": "BDT",
"currency_value": 121.951,
"metadata": [],
"created_time": "2026-01-04 16:04:35",
"payment_time": "2026-01-04 16:12:37",
"paymentkey": "fnPwIkdIsMjN4FJxYxw6DF75GuW9qStn",
"webhook": [],
"payment_info": {
"m0": "SSLCommerz",
"status": "VALID",
"tran_date": "2026-01-04 16:05:04",
"tran_id": "IGQM_695a3b59h6a9"
},
"status": "EXECUTED" //Can be PENDING/COMPLETED/EXECUTED
}The Query API may return one of the following statuses:
| Status | Description |
|---|---|
PENDING | Payment created but not completed |
COMPLETED | Payment completed, ready for execute |
EXECUTED | Payment finalized |
CANCELLED | Payment cancelled |
Response objects are returned as stdClass, allowing direct access like:
$query->full_name;
$query->status;Webhooks (Laravel)
Bohudur sends webhook notifications using POST JSON.
Success Payload
{
"full_name": "Jane Doe",
"email": "janedoe@gmail.com",
"amount": 1,
"paymentkey": "CrD85r3ibMK6ip38reUcuECvVhaF0xOT",
"status": "COMPLETED"
}Cancel Payload
{
"full_name": "Jane Doe",
"email": "janedoe@gmail.com",
"amount": 1,
"paymentkey": "CrD85r3ibMK6ip38reUcuECvVhaF0xOT",
"status": "CANCELLED"
}Webhook Handler Example
Route::post('/bohudur/webhook', function () {
$data = request()->all();
// Always verify
Bohudur::query($data['paymentkey']);
});Best Practices
- Always verify payments using Query API
- Never execute payments from frontend
- Webhooks are not final truth
- Execute payments only once
API Versioning
- Current Version: v2
- Base URL includes versioning for stability
Support
For technical support or integration help, contact Bohudur Telegram Support.
