PHP code example of sujanshresthanet / esewa-php-sdk

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

    

sujanshresthanet / esewa-php-sdk example snippets


// quire 'vendor/autoload.php';

use Cixware\Esewa\Client;

// init client for development
$esewa = new Client([
    'success_url' => 'https://example.com/success.php', // callback url for success
    'failure_url' => 'https://example.com/failed.php', // callback url for failure
]);

// init client for production
$esewa = new Client([
    'is_production' => true,
    'merchant_code' => 'b4e...e8c753...2c6e8b', // retrieve from eSewa
    'success_url' => 'https://example.com/success.php', // callback url for success
    'failure_url' => 'https://example.com/failed.php', // callback url for failure
]);

$esewa->process('P101W201', 100, 15, 80, 50);

$status = $esewa->verify('R101', 'P101W201', 245);
if ($status->verified) {
    // verification successful
}

composer sujanshresthanet/esewa-php-sdk