PHP code example of cixware / esewa-php-sdk

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

    

cixware / esewa-php-sdk example snippets


// Init composer autoloader.
t;

// Set success and failure callback URLs.
$successUrl = 'https://example.com/success.php';
$failureUrl = 'https://example.com/failed.php';

// Initialize eSewa client for development.
$esewa = new Client([
    'merchant_code' => 'EPAYTEST',
    'success_url' => $successUrl,
    'failure_url' => $failureUrl,
]);

// Initialize eSewa client for production.
$esewa = new Client([
    'merchant_code' => 'b4e...e8c753...2c6e8b',
    'success_url' => $successUrl,
    'failure_url' => $failureUrl,
]);

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

$status = $esewa->verifyPayment('R101', 'P101W201', 245);
if ($status) {
    // Verification successful.
}

composer