nujan/esewa

Package to seamlessly integrate eSewa payment gateway to laravel project.

v1.0.0 2024-05-04 07:40 UTC

This package is auto-updated.

Last update: 2025-06-05 17:32:10 UTC


README

This package provides a seamless integration of the eSewa payment gateway into a Laravel project.

Installation

You can install the package via composer:

composer require nujan/esewa:@dev

After installing the package, publish the configuration file:

php artisan vendor:publish --provider="Nujan\Esewa\EsewaServiceProvider"

This will create a esewa.php config file in your config directory.

Configuration

The environment variables ESEWA_MERCHANT_CODE, ESEWA_SECRET, and ESEWA_API_ENDPOINT should be set in your .env file:

ESEWA_MERCHANT_CODE=your_merchant_code
ESEWA_SECRET=your_secret_key
ESEWA_API_ENDPOINT=your_api_endpoint

Usage

Here's a basic usage example:

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

License

The MIT License (MIT). Please see License File for more information.


Please replace `your_merchant_code`, `your_secret_key`, and `your_api_endpoint` with your actual eSewa merchant code, secret key, and API endpoint.