PHPackages                             rudraramesh/esewa-payment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. rudraramesh/esewa-payment

ActiveLibrary[Payment Processing](/categories/payments)

rudraramesh/esewa-payment
=========================

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.

v2.0.0(9mo ago)24MITPHPPHP &gt;=7.4

Since Jan 30Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/rudraramesh/esewa-payment-integration)[ Packagist](https://packagist.org/packages/rudraramesh/esewa-payment)[ Docs](https://github.com/RudraRamesh/esewa-payment)[ RSS](/packages/rudraramesh-esewa-payment/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

Laravel eSewa Payment Gateway Integration
=========================================

[](#laravel-esewa-payment-gateway-integration)

**Current Version:** v2.0.0

[![Latest Version on Packagist](https://camo.githubusercontent.com/244960e3d3a59f9bd3ffcbd592ab0c2d57a7634d4385bf30564296d80798b35b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f727564726172616d6573682f65736577612d7061796d656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rudraramesh/esewa-payment)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

A Laravel package for seamless integration of the [eSewa](https://esewa.com.np) 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
--------

[](#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
------------

[](#installation)

1. Install the Package:

    ```
    composer require rudraramesh/esewa-payment
    ```
2. Publish Configuration and Views

    ```
    php artisan vendor:publish --provider="Rbb\ESewaPayment\Providers\ESewaPaymentServiceProvider" --tag=config
    php artisan vendor:publish --provider="Rbb\ESewaPayment\Providers\ESewaPaymentServiceProvider" --tag=views
    ```

    This will copy the config file to `config/esewa.php` and the views to `resources/views/vendor/esewa-payment/` so you can customize them.
3. Add Configuration to .env

    ```
    ESEWA_ENVIRONMENT=sandbox # or live
    ESEWA_MERCHANT_CODE=your_merchant_code
    ESEWA_API_KEY=your_api_key
    ESEWA_API_PASSWORD=your_api_password
    ESEWA_SUCCESS_URL=https://your-site.com/esewa/success
    ESEWA_FAILED_URL=https://your-site.com/esewa/failure
    ESEWA_CALLBACK_URL=https://your-site.com/esewa/callback
    ```

Configuration File
------------------

[](#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
-----

[](#usage)

### 1. Routes

[](#1-routes)

The package automatically registers the following routes (with prefix `esewa.`):

MethodURINameDescriptionPOST/esewa/paymentesewa.paymentInitiate paymentPOST/esewa/callbackesewa.callbackHandle eSewa callbackGET/esewa/successesewa.successSuccess redirect (optional)GET/esewa/failureesewa.failureFailure redirect (optional)### 2. Initiate Payment

[](#2-initiate-payment)

Send a POST request to `/esewa/payment` with `amount` and `order_id`:

```
$response = Http::post('/esewa/payment', [
    'amount' => 1000,
    'order_id' => 'ORDER123',
]);
```

Or, from a form:

```

    @csrf

    Pay with eSewa

```

### 3. Handle Callback

[](#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

[](#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.php`
- `resources/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

[](#5-events)

Listen for payment events in your application:

```
Event::listen('esewa.payment.success', function ($payload) {
    // Handle payment success
});
Event::listen('esewa.payment.failed', function ($payload) {
    // Handle payment failure
});
```

Sandbox/Live Environment
------------------------

[](#sandboxlive-environment)

Set `ESEWA_ENVIRONMENT=sandbox` for testing, or `live` for production. The package will use the correct endpoints automatically.

Error Handling
--------------

[](#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
-----

[](#links)

- [eSewa Official Website](https://esewa.com.np)
- [Packagist Package](https://packagist.org/packages/rudraramesh/esewa-payment)
- [GitHub Repository](https://github.com/RudraRamesh/esewa-payment)
- [Report Issues](https://github.com/RudraRamesh/esewa-payment/issues)

Contributing
------------

[](#contributing)

Feel free to fork the repository and create pull requests. Please follow best practices and write tests if you add new features.

License
-------

[](#license)

This package is open-sourced under the MIT License. See the [LICENSE File](LICENSE) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance56

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Recently: every ~0 days

Total

7

Last Release

291d ago

Major Versions

v1.0.6 → v2.0.02025-07-25

PHP version history (2 changes)V1.0.1PHP ^7.4 || ^8.0

v1.0.4PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ee24e4136339578d209efc1e185915bf09e79b3bdfa040e91900c58bd12c192?d=identicon)[rudraramesh](/maintainers/rudraramesh)

---

Top Contributors

[![rudraramesh](https://avatars.githubusercontent.com/u/54761880?v=4)](https://github.com/rudraramesh "rudraramesh (20 commits)")

---

Tags

laravellaravel-packagepaymentgatewaypayment gatewayonline-paymentesewanepalesewa-laravelesewa-payment

### Embed Badge

![Health badge](/badges/rudraramesh-esewa-payment/health.svg)

```
[![Health](https://phpackages.com/badges/rudraramesh-esewa-payment/health.svg)](https://phpackages.com/packages/rudraramesh-esewa-payment)
```

###  Alternatives

[evryn/laravel-toman

A simple stable Laravel package to handle popular payment gateways in Iran including ZarinPal and IDPay.

1079.9k](/packages/evryn-laravel-toman)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
