Skip to content
/ esewa Public

Integrate eSewa payment gateway for online payments. A php library to comsume eSewa payment gateway API, built on top of Omnipay Payment processing library. Read the blog post to follow the step by step guide on how to integrate esewa with Laravel PHP framework.

License

Notifications You must be signed in to change notification settings

sudiptpa/esewa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Omnipay: eSewa

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 [email protected] 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.

About

Integrate eSewa payment gateway for online payments. A php library to comsume eSewa payment gateway API, built on top of Omnipay Payment processing library. Read the blog post to follow the step by step guide on how to integrate esewa with Laravel PHP framework.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages