Skip to content

bKash Payment Gateway API for Laravel Framework.

License

Notifications You must be signed in to change notification settings

msisaif/laravel-package-bkash-payment-gateway

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Total Downloads Latest Stable Version License Github Stars

msilas/bkash

bKash Payment Gateway API for Laravel Framework.

Requirements

  • PHP >=7.4
  • Laravel >= 6

Get Started

Install msilabs/bkash via the Composer package manager:

composer require msilabs/bkash

Optionally, publish the configuration file

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

Set .env configuration

BKASH_SANDBOX=true  #for production use false
BKASH_APP_KEY=""
BKASH_APP_SECRET=""
BKASH_USERNAME=""
BKASH_PASSWORD=""
BKASH_CALLBACK_URL=""

Sandbox validation

Start local server.

php artisan serve

To get create-payment data visit /bkash-sandbox/create-payment url

http://127.0.0.1:8000/bkash-sandbox/create-payment

To get execute-payment data visit /bkash-sandbox/execute-payment url

http://127.0.0.1:8000/bkash-sandbox/execute-payment

Sandbox Uses

included BkashPayment trait in your controller. like:

use Msilabs\Bkash\BkashPayment;

class BkashController extends Controller
{
  use BkashPayment;

  //
}

create payment

public function payment()
{
  // your code 

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

  if($response->bkashURL) {
    return redirect($response->bkashURL);
  }
}

execute payment

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
}

Production Use

set Live Credentials in .env

BKASH_SANDBOX=false
BKASH_APP_KEY=""
BKASH_APP_SECRET=""
BKASH_USERNAME=""
BKASH_PASSWORD=""
BKASH_CALLBACK_URL=""

About

bKash Payment Gateway API for Laravel Framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%