PHP code example of nujan / esewa

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

    

nujan / esewa example snippets


use Nujan\Esewa\Esewa;

$esewa = new Esewa();

$data = [
    'amount' => 100,
    'tax_amount' => 10,
    'total_amount' => 110,
    'transaction_uuid' => uniqid(mt_rand(), true),
    'product_code' => 'EPAYTEST',
    'product_service_charge' => 0,
    'product_delivery_charge' => 0,
    'success_url' => 'http://review.test/esewa/success',
    'failure_url' => 'https://google.com',
    'signed_field_names' => 'total_amount,transaction_uuid,product_code',
];

$response = $esewa->sendPaymentRequest($data);

// Handle the response as needed
bash
php artisan vendor:publish --provider="Nujan\Esewa\EsewaServiceProvider"