1. Go to this page and download the library: Download bdpay/laravel-bdpay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bdpay / laravel-bdpay example snippets
use BDPay\LaravelBDPay\Facades\BDPay;
// Create a Virtual Account
$vaData = BDPay::fundAcceptance()->createVA([
'amount' => 100000, // Amount in IDR (100,000 IDR)
'order_id' => 'ORDER-' . time(),
'customer_name' => 'John Doe',
'customer_email' => '[email protected]',
'customer_phone' => '081234567890',
'description' => 'Payment for order #123',
'expired_at' => now()->addDays(1),
'bank_code' => 'BCA', // Optional
]);
// Create a Payment Link
$paymentLinkData = BDPay::fundAcceptance()->createPaymentLink([
'amount' => 100000,
'order_id' => 'ORDER-' . time(),
'customer_name' => 'John Doe',
'customer_email' => '[email protected]',
'customer_phone' => '081234567890',
'description' => 'Payment for order #123',
'payment_method' => 'all', // or specific payment method
'redirect_url' => 'https://yourdomain.com/payment/success',
'callback_url' => 'https://yourdomain.com/bdpay/webhook/payment',
]);
// Create a Static Virtual Account
$staticVAData = BDPay::fundAcceptance()->createStaticVA([
'customer_name' => 'John Doe',
'customer_email' => '[email protected]',
'customer_phone' => '081234567890',
'description' => 'Static VA for customer',
'bank_code' => 'BCA',
]);
// Check Payment Status
$status = BDPay::fundAcceptance()->getPaymentStatus('ORDER-123456');
use BDPay\LaravelBDPay\Models\BDPayTransaction;
// Get all successful payments
$successfulPayments = BDPayTransaction::payments()->successful()->get();
// Get pending disbursements
$pendingDisbursements = BDPayTransaction::disbursements()->pending()->get();
// Get transaction by order ID
$transaction = BDPayTransaction::where('order_id', 'ORDER-123')->first();
// Format amount for BDPay API (multiply by 100 for IDR)
$formattedAmount = BDPay::fundAcceptance()->formatAmount(1000.00, 'IDR'); // Returns 100000
// Parse amount from BDPay response
$parsedAmount = BDPay::fundAcceptance()->parseAmount(100000, 'IDR'); // Returns 1000.00
// Or use disbursement service for disbursement amounts
$disbursementAmount = BDPay::fundDisbursement()->formatAmount(500.00, 'IDR'); // Returns 50000
// Note: Bank code validation is handled by BDPay API
// Use any bank code supported by BDPay (BCA, BNI, BRI, MANDIRI, etc.)
// Generate signature for webhook verification
$signature = BDPay::generateSignature($data);
// Verify webhook signature
$isValid = BDPay::verifySignature($signature, $data);