Download the PHP package rudraramesh/esewa-payment without Composer
On this page you can find all versions of the php package rudraramesh/esewa-payment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rudraramesh/esewa-payment
More information about rudraramesh/esewa-payment
Files in rudraramesh/esewa-payment
Package esewa-payment
Short Description A Laravel package designed to simplify the integration of the eSewa payment gateway into your Laravel applications. This package provides an easy-to-use solution for handling online payments with eSewa, one of Nepal's leading payment gateways. It supports initiating payments, verifying transactions, and handling payment success or failure.
License MIT
Homepage https://github.com/RudraRamesh/esewa-payment
Informations about the package esewa-payment
Laravel eSewa Payment Gateway Integration
Current Version: v2.0.0
A Laravel package for seamless integration of the eSewa payment gateway, the leading online payment solution in Nepal. Easily accept online payments in your Laravel application using eSewa, with secure server-to-server verification and customizable success/failure pages.
Features
- Laravel eSewa payment gateway integration
- Supports online payments in Nepal
- Secure server-to-server transaction verification
- Easy configuration and setup
- Customizable success and failure views
- Compatible with Laravel 9, 10, 11, 12 and PHP 7.4, 8.x
- Extensible: fires events on payment success/failure
Installation
-
Install the Package:
-
Publish Configuration and Views
This will copy the config file to
config/esewa.phpand the views toresources/views/vendor/esewa-payment/so you can customize them. - Add Configuration to .env
Configuration File
The package uses config/esewa.php to manage settings like the merchant code, API credentials, environment, and URLs for payment success, failure, and callback.
Usage
1. Routes
The package automatically registers the following routes (with prefix esewa.):
| Method | URI | Name | Description |
|---|---|---|---|
| POST | /esewa/payment | esewa.payment | Initiate payment |
| POST | /esewa/callback | esewa.callback | Handle eSewa callback |
| GET | /esewa/success | esewa.success | Success redirect (optional) |
| GET | /esewa/failure | esewa.failure | Failure redirect (optional) |
2. Initiate Payment
Send a POST request to /esewa/payment with amount and order_id:
Or, from a form:
3. Handle Callback
The package will handle the callback from eSewa and perform server-to-server verification. On success/failure, it will redirect to the configured URLs.
4. Customizing Views
The package provides default success and failure views that use standalone HTML and Bootstrap for styling. You can customize these views after publishing:
resources/views/vendor/esewa-payment/success.blade.phpresources/views/vendor/esewa-payment/failure.blade.php
You can edit these files to match your application's look and feel. There is no dependency on any specific layout.
5. Events
Listen for payment events in your application:
Sandbox/Live Environment
Set ESEWA_ENVIRONMENT=sandbox for testing, or live for production. The package will use the correct endpoints automatically.
Error Handling
- Input is validated before initiating payment.
- All errors are logged using Laravel's logger.
- Server-to-server verification is performed for security.
Links
Contributing
Feel free to fork the repository and create pull requests. Please follow best practices and write tests if you add new features.
License
This package is open-sourced under the MIT License. See the LICENSE File for more information.