PHPackages                             sarojsardar/esewa-epay - 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. sarojsardar/esewa-epay

ActiveLibrary[Payment Processing](/categories/payments)

sarojsardar/esewa-epay
======================

eSewa Payment Integration Package for Laravel

04PHP

Since Oct 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sarojsardar/esewa-epay)[ Packagist](https://packagist.org/packages/sarojsardar/esewa-epay)[ RSS](/packages/sarojsardar-esewa-epay/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

eSewa Payment Integration Package for Laravel
=============================================

[](#esewa-payment-integration-package-for-laravel)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)

This package provides a simple and effective way to integrate eSewa payment processing into your Laravel application. It supports initiating payments and verifying transactions through the eSewa API.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Set Up Environment Variables](#set-up-environment-variables)
    - [Using the Service](#using-the-service)
    - [Payment Form View](#payment-form-view)
    - [Defining Routes](#defining-routes)
- [Example Controller](#example-controller)
- [Testing the Package](#testing-the-package)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- Easy integration with eSewa payment gateway.
- Supports payment initiation and transaction verification.
- Customizable payment form view.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 11.x

Installation
------------

[](#installation)

1. **Install the package via Composer**:

    Run the following command in your Laravel project directory:

    ```
    composer require sarojsardar/esewa-epay:dev-main
    ```

Publish the configuration file:

After installation, publish the package configuration file using the following command:

bash Copy code

- php artisan vendor:publish --provider="Sarojsardar\\EsewaEpay\\EsewaEpayServiceProvider"

This command will create a configuration file at config/esewa.php.

Configuration Add your eSewa merchant credentials to your .env file:

env Copy code ESEWA\_MERCHANT\_CODE=your\_merchant\_code ESEWA\_SECRET=your\_secret\_key ESEWA\_API\_ENDPOINT=Replace your\_merchant\_code and your\_secret\_key with the appropriate values provided by eSewa. For production, change the API endpoint to: env Copy code ESEWA\_API\_ENDPOINT=Usage Set Up Environment Variables Ensure that you have set up the environment variables as shown in the configuration section.

Using the Service You can use the EpayService class in your controllers to handle payments.

Payment Form View The package provides a view for the payment form. You can customize it as needed. The view is located at resources/views/vendor/esewa/payment-form.blade.php.

Defining Routes Define routes in your web.php file for initiating and verifying payments:

php Copy code use App\\Http\\Controllers\\PaymentController;

Route::get('/payment/initiate', \[PaymentController::class, 'initiatePayment'\]); Route::get('/payment/verify/{transactionId}', \[PaymentController::class, 'verifyPayment'\]); Example Controller Create a controller named PaymentController:

php Copy code namespace App\\Http\\Controllers;

use Sarojsardar\\EsewaEpay\\EpayService; use Illuminate\\Http\\Request;

class PaymentController extends Controller { protected $epayService;

```
public function __construct(EpayService $epayService)
{
    $this->epayService = $epayService;
}

// Method to initiate payment
public function initiatePayment(Request $request)
{
    $amount = $request->input('amount', 100); // Default amount
    $transactionUuid = 'your-transaction-uuid'; // Generate a unique transaction UUID
    $productCode = 'EPAYTEST';
    $successUrl = 'https://your-success-url.com';
    $failureUrl = 'https://your-failure-url.com';

    return $this->epayService->initiatePayment($amount, $transactionUuid, $productCode, $successUrl, $failureUrl);
}

// Method to verify payment
public function verifyPayment($transactionId)
{
    $result = $this->epayService->verifyTransaction($transactionId);

    // Handle the result as needed
    return response()->json($result);
}

```

} Testing the Package To test the package, you can use the following steps:

Run your Laravel application: Start your local server with:

bash Copy code php artisan serve Initiate a payment: Open your browser and navigate to . This should redirect you to the eSewa payment page.

Verify the payment: After completing the payment, you will be redirected to the success URL you specified. You can verify the transaction by calling the verifyPayment method with the transaction ID.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ba59374922b1b0b553348c271f6ab392896766f76449ca59ae6f739ba1c515c?d=identicon)[sarojsardar](/maintainers/sarojsardar)

---

Top Contributors

[![sarojsardar](https://avatars.githubusercontent.com/u/108754250?v=4)](https://github.com/sarojsardar "sarojsardar (7 commits)")

### Embed Badge

![Health badge](/badges/sarojsardar-esewa-epay/health.svg)

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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