PHP code example of devrkb21 / bkash-pgw-laravel

1. Go to this page and download the library: Download devrkb21/bkash-pgw-laravel 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/ */

    

devrkb21 / bkash-pgw-laravel example snippets


use Bkash;

$url = Bkash::payment()->createPayment([
    'payerReference' => 'user_123',
    'callbackURL' => route('bkash.callback'),
    'amount' => '100',
    'currency' => 'BDT',
    'intent' => 'sale',
    'merchantInvoiceNumber' => 'INV123456',
]);

return redirect($url->bkash_url);

Bkash::payment()->createPayment([...]);

Bkash::payment()->handleCallback(request()->all());

Bkash::payment()->queryPayment($paymentId);

Bkash::payment()->capturePayment($paymentId);
Bkash::payment()->voidPayment($paymentId);

Bkash::agreement()->createAgreement([...]);
Bkash::agreement()->executeAgreement($agreementId);

Bkash::refund()->refundTransaction([
    'paymentId' => $paymentId,
    'trxId' => $trxId,
    'refundAmount' => '10',
    'reason' => 'Customer request',
]);

'enable_routes' => true,
bash
php artisan vendor:publish --tag=bkash-config

POST /bkash/webhook

POST /bkash/webhook