Download the PHP package abdursoft/laravel-bkash without Composer

On this page you can find all versions of the php package abdursoft/laravel-bkash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-bkash

Bkash tokenized payment gateway integration for PHP and Laravel applicaation

Now you can easily integrate bkash tokenized payment gateway into your PHP and laravel application. Just follow up the below process. Hope you will integrate the Bkash payment gateway successfully in your PHP or Laravel application

Now let's start with abdursoft/laravel-bkash. Run the below command to install the package.

composer require abdursoft/laravel-bkash

After installing the package you have to update .env file from your root folder with the below code.

BKASH_USERNAME=017xxxxxxx
BKASH_PASSWORD=D7xxxxxxxx
BKASH_APP_KEY=APKxxxxxxxx
BKASH_APP_SECRET=APSxxxxxxx

[Note] Remember you have to update these variable with your credentials.

If the package/library successfully installed on your project then make a controller in your laravel project.

php artisan make:controller BkashController

If your controller has been successfully created, open with your text editor and replace all code with below code.

namespace App\Http\Controllers;

use Abdursoft\LaravelBkash\Bkash;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;

class BkashController extends Controller
{

    protected $bkash;
    public function __construct()
    {

        $this->bkash = new Bkash(env('BKASH_USERNAME'),env('BKASH_PASSWORD'),env('BKASH_APP_KEY'),env('BKASH_APP_SECRET'),'sandbox',"http://127.0.0.1:8000/bkash/callback"); //use sandbox for sandbox testing and production for production service
    }

    /**
     * Create payment
     */
    public function createPayment(Request $request){
        $validator = Validator::make($request->all(),[
            'amount' => 'required',
            'reference' => 'required',
        ]);

        if($validator->fails()){
            return response()->json($validator->errors());
        }

        $payment = $this->bkash->paymentCreate($request->reference,$request->amount,uniqid());
        return redirect()->away($payment['bkashURL']);
    }

    /**
     * Refund payment
     */
    public function refundPayment(Request $request){
        $refund = $this->bkash->refund($request->id,$request->txn,$request->amount,$request->sku,$request->reason);
        if($refund['statusCode'] === '0000'){
            return redirect('/')->with('success',"Refund process has been completed");
        }else{
            return redirect('/')->with('error',"Refund process has been faild");
        }
    }

    /**
     * Bkash callback
     */
    public function callbackResponse(Request $request){
        if($request->query('status') == 'success'){
            $execute = $this->bkash->paymentExecute($request->query('paymentID'));
            Session::put(['paymentExecution' => $execute]);
            if($execute['statusCode'] == '0000'){
                return redirect('/')->with('success','Payment has been completed');
            }elseif($execute['statusCode'] == '2062'){
                return redirect('/')->with('success','Payment has already been compeled');
            }
        }elseif($request->query('status') == 'cancel'){
            return redirect('/')->with('error','Payment has been canceled');
        }elseif($request->query('status') == 'failure'){
            return redirect('/')->with('error','Payment has been faild');
        }else{
            return redirect('/')->with('error','Payment couldn\'t completed');
        }
    }
}

At this stage you have to initalize the payment routes for baksh gateway. You can put the below routes or You can create your owns.

Route::prefix('bkash')->group(function(){
    Route::post('payment', [BkashController::class, 'createPayment']);
    Route::post('refund', [BkashController::class, 'refundPayment']);
    Route::get('cancel', [BkashController::class, 'callbackResponse']);
    Route::get('callback', [BkashController::class, 'callbackResponse']);
});

Don't forget to add use App\Http\Controllers\BkashController; in your route page.

To create a payment, you have to pass some data such as amount reference merchant_invoice_number callback_url.

``amount`` for the payable amount.
``reference`` for the payment reference.
``merchant_invoice_number`` for futrue tracking the payment and remember it shuold be unique.
``callback_url`` bkash will redirect the user after payment processcing and you have to execute payment with this route's response.

To create a refund, you have to pass some data such as transactionID paymentID amount reason sku

``transactionID`` use from a completed transaction.
``paymentID`` use the paymentID from above transaction.
``amount`` use a valid amount for refund and make sure the amount not bigger than above transaction.
``reason`` for refund the transaction.
``sku`` for the transaction processing.

All versions of laravel-bkash with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package abdursoft/laravel-bkash contains the following files

Loading the files please wait ....