PHP code example of act360 / laravel-esewa

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

    

act360 / laravel-esewa example snippets


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

namespace App;

use Esewa\Billable;

Class Store extends Model
{
    use Billable;
}

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.
    }
}