sudiptpa/omnipay-esewa

eSewa API driver for the Omnipay payment processing library.

v1.0.1 2020-07-14 11:43 UTC

This package is auto-updated.

Last update: 2024-11-04 12:38:53 UTC


README

eSewa driver for the Omnipay PHP payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements eSewa support for Omnipay.

StyleCI Latest Stable Version Total Downloads GitHub license

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and sudiptpa/omnipay-esewa with Composer:

composer require league/omnipay sudiptpa/omnipay-esewa

Basic Usage

Purchase

    use Omnipay\Omnipay;
    use Exception;

    $gateway = Omnipay::create('Esewa_Secure');

    $gateway->setMerchantCode('epay_payment');
    $gateway->setTestMode(true);

    try {
        $response = $gateway->purchase([
            'amount' => 100,
            'deliveryCharge' => 0,
            'serviceCharge' => 0,
            'taxAmount' => 0,
            'totalAmount' => 100,
            'productCode' => 'ABAC2098',
            'returnUrl' => 'https://merchant.com/payment/1/complete',
            'failedUrl' => 'https://merchant.com/payment/1/failed',
        ])->send();

        if ($response->isRedirect()) {
            $response->redirect();
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }

After successful payment and redirect back to merchant site, you need to now verify the payment with another API request.

Verify Payment

    $gateway = Omnipay::create('Esewa_Secure');

    $gateway->setMerchantCode('epay_payment');
    $gateway->setTestMode(true);

    $response = $gateway->verifyPayment([
        'amount' => 100,
        'referenceNumber' => 'GDFG89',
        'productCode' => 'gadfg-gadf',
    ])->send();

    if ($response->isSuccessful()) {
        // Success
    }

    // Failed

Laravel Integration

Please follow the eSewa Online Payment Gateway Integration and follow step by step guidlines.

Official Doc

Please follow the Official Doc to understand about the parameters and their descriptions.

Contributing

Contributions are welcome and will be fully credited.

Contributions can be made via a Pull Request on Github.

Support

If you are having general issues with Omnipay Esewa, drop an email to sudiptpa@gmail.com for quick support.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

License

This package is open-sourced software licensed under the MIT license.