PHP code example of msilabs / bkash

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

    

msilabs / bkash example snippets

bash
php artisan vendor:publish --provider="Msilabs\Bkash\BkashServiceProvider"
bash
php artisan serve

public function payment()
{
  // your code 

  $response = $this->createPayment($amount, $invoice_id, $callback_url);

  return redirect($response->bkashURL);
}


public function callback(Request $request)
{
  $payment_id = $request->paymentID;
  $status = $request->status;

  if($paymentID && $status == 'success') {
      $response = $this->executePayment($paymentID);

      if($response->transactionStatus == 'Completed') {
          $order_id = $response['merchantInvoiceNumber'];
          $trxID = $response['trxID'];

          // your code
      }

  }

  // your code
}