LaravelPackages.net
Acme Inc.
Toggle sidebar
act360/laravel-esewa

A E-sewa payment gateway integration for laravel

133
7
v0.1.2
About act360/laravel-esewa

act360/laravel-esewa is a Laravel package for a e-sewa payment gateway integration for laravel. It currently has 7 GitHub stars and 133 downloads on Packagist (latest version v0.1.2). Install it with composer require act360/laravel-esewa. Discover more Laravel packages by act360 or browse all Laravel packages to compare alternatives.

Last updated

Easy Esewa Payment Integration For Your Laravel App

This composer package offers a E-sewa payment gateway setup for your Laravel applications.

Installation

Begin by pulling in the package through Composer.

composer require act360/laravel-esewa

Next, if using Laravel 5, include the service provider within your config/app.php file.

'providers' => [
    Esewa\EsewaServiceProvider::class,
];

Finally, add these variable to .env.

ESEWA_MERCHANT_ID=YOUR_ESEWA_MERCHANT_ID ESEWA_TRANSACTION_URL=ESEWA_PAYMENT_URL

Usage

Within your Model, make a call to the Billable trait.

namespace App;

use Esewa\Billable;

Class Store extends Model
{
    use Billable;
}

You can use this on controller as:

Class StoreController extends Controller
{
    public function create(Request $request, Store $store)
    {
        $item = $store->create($request->all());
        $payment_details = [
            'tAmt' => 100,
            'amt' => 100,
            'pid' => "PR-01",
            'su' => "YOUR_SUCCESS_URL",
            'fu' => "YOUR_FAILURE_URL"
        ];
        $item->charge($payment_details);
    }

    public function success()
    {
        // Do something here when payment success.
    }

    public function failure()
    {
        // Do something here when payment failure.
    }
}

Done! You'll now be able to use esewa gateway.

Comments