nujan / esewa
Package to seamlessly integrate eSewa payment gateway to laravel project.
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
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.