PHP code example of irfan-chowdhury / bkash-tokenized-checkout

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

    

irfan-chowdhury / bkash-tokenized-checkout example snippets


"    "php": ">= 8.0",
    "laravel/framework": ">= 9.0"
},

composer 

'providers' => [
    /*
    * Package Service Providers...
    */
    IrfanChowdhury\BkashTokenizedCheckout\BkashServiceProvider::class,
],

Please follow the instructions given below -

    public function checkout()
    {
        return view('bkash::checkout');
    }


    public function bkashCallback(PaymentService $paymentService, Request $request)
    {
        try {
            $payment = $paymentService->initialize('bkash');

            $payment->paymentStatusCheck($request);

            session()->put('paymentID', $request->paymentID);

            // Implement your other business logic after payment done.

            return redirect()->route('payment.success')->with(['success' => 'Payment Successfully Done']);
        }
        catch (Exception $e) {

            return redirect()->route('checkout')->withErrors(['errors' => $e->getMessage()]);
        }
    }

use App\Http\Controllers\BkashPaymentController;
use Illuminate\Support\Facades\Route;

Route::controller(BkashPaymentController::class)->group(function () {
    Route::prefix('payment')->group(function () {
        Route::get('checkout', 'checkout')->name('checkout');
        Route::get('bkash/callback','bkashCallback');
    });
});
bash
php artisan vendor:publish --provider="IrfanChowdhury\BkashTokenizedCheckout\BkashServiceProvider"
bash
https://sandbox.payment.bkash.com/?paymentId=TR0011hEN7KTZ1718449546941&hash=)gqMffGT.r.4*dLWGcc)mE_6q9U)wmmh9SI6hTlkjzNc!IFGOZZCN5Fe1I0FGRtIXxl!sNdP00LAv)mjDLg6iu8cAKr**0g(WHZC1718449546941&mode=0011&apiVersion=v1.2.0-beta/