PHPackages                             nutandc/nepal-payment-gateway - 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. nutandc/nepal-payment-gateway

ActiveLibrary[Payment Processing](/categories/payments)

nutandc/nepal-payment-gateway
=============================

Nepal payment gateway integration for Laravel: eSewa, Khalti, ConnectIPS, optional Stripe, idempotent and secure.

v1.0.3(4mo ago)02MITPHPPHP ^8.2CI passing

Since Jan 3Pushed 4mo agoCompare

[ Source](https://github.com/Nutandc/Nepal-Payment-Gateway)[ Packagist](https://packagist.org/packages/nutandc/nepal-payment-gateway)[ Docs](https://github.com/Nutandc/nepal-payment-gateway)[ RSS](/packages/nutandc-nepal-payment-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (4)Used By (0)

Nepal Payment Gateway
=====================

[](#nepal-payment-gateway)

[![CI](https://github.com/Nutandc/Nepal-Payment-Gateway/actions/workflows/ci.yml/badge.svg)](https://github.com/Nutandc/Nepal-Payment-Gateway/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/b99bef76b5607042c0cdfeb89fc28c033fec418350cebbfb097abb1f95d8fbbb/68747470733a2f2f706f7365722e707567782e6f72672f6e7574616e64632f6e6570616c2d7061796d656e742d676174657761792f76657273696f6e)](https://packagist.org/packages/nutandc/nepal-payment-gateway)[![Total Downloads](https://camo.githubusercontent.com/d66deffd22371502b495caa91d14a7bee1bdb75ab5c7c301fc2815bd4325062f/68747470733a2f2f706f7365722e707567782e6f72672f6e7574616e64632f6e6570616c2d7061796d656e742d676174657761792f642f746f74616c)](https://packagist.org/packages/nutandc/nepal-payment-gateway)[![License](https://camo.githubusercontent.com/76d7ca96750b4f76913144549e8f118650599083d1defc28b47234f8e7e3c61a/68747470733a2f2f706f7365722e707567782e6f72672f6e7574616e64632f6e6570616c2d7061796d656e742d676174657761792f6c6963656e7365)](LICENSE)

Laravel-first payment gateway package for Nepal gateways with optional Stripe support. Built for PHP 8.2+ and Laravel 10+ with clean, typed, and configurable services.

Features
--------

[](#features)

- Nepal gateways: eSewa, Khalti, ConnectIPS
- Optional Stripe integration (Checkout Session)
- Config-driven endpoints and credentials (no hardcoded URLs)
- Idempotency support to prevent duplicate transactions
- PSR-3 logging and structured error handling
- SOLID, typed, and testable services

Gateway flags
-------------

[](#gateway-flags)

GatewayConfig KeyDefaulteSewa`NEPAL_PAYMENT_ESEWA_ENABLED``true`Khalti`NEPAL_PAYMENT_KHALTI_ENABLED``true`ConnectIPS`NEPAL_PAYMENT_CONNECTIPS_ENABLED``true`Stripe`NEPAL_PAYMENT_STRIPE_ENABLED``false`Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10/11/12
- Extensions: `ext-curl`, `ext-openssl`

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

[](#installation)

```
composer require nutandc/nepal-payment-gateway
```

Publish config:

```
php artisan vendor:publish --tag=nepal-payment-suite-config
```

Configuration
-------------

[](#configuration)

Copy `.env.example` values into your Laravel `.env` file and update them for your gateway accounts.

Set `.env` values as needed (examples):

```
NEPAL_PAYMENT_GATEWAY=esewa

NEPAL_PAYMENT_ESEWA_ENABLED=true
NEPAL_PAYMENT_ESEWA_BASE_URL=your_esewa_base_url
NEPAL_PAYMENT_ESEWA_ENDPOINT_INITIATE=your_esewa_initiate_path
NEPAL_PAYMENT_ESEWA_ENDPOINT_VERIFY=your_esewa_verify_path
NEPAL_PAYMENT_ESEWA_PRODUCT_CODE=your_product_code
NEPAL_PAYMENT_ESEWA_SECRET_KEY=your_secret_key

NEPAL_PAYMENT_KHALTI_ENABLED=true
NEPAL_PAYMENT_KHALTI_BASE_URL=your_khalti_base_url
NEPAL_PAYMENT_KHALTI_ENDPOINT_INITIATE=your_khalti_initiate_path
NEPAL_PAYMENT_KHALTI_ENDPOINT_LOOKUP=your_khalti_lookup_path
NEPAL_PAYMENT_KHALTI_SECRET_KEY=your_secret_key

NEPAL_PAYMENT_CONNECTIPS_ENABLED=true
NEPAL_PAYMENT_CONNECTIPS_BASE_URL=your_connectips_base_url
NEPAL_PAYMENT_CONNECTIPS_ENDPOINT_INITIATE=your_connectips_initiate_path
NEPAL_PAYMENT_CONNECTIPS_ENDPOINT_VERIFY=your_connectips_verify_path
NEPAL_PAYMENT_CONNECTIPS_MERCHANT_ID=your_merchant_id
NEPAL_PAYMENT_CONNECTIPS_APP_ID=your_app_id
NEPAL_PAYMENT_CONNECTIPS_APP_NAME=your_app_name
NEPAL_PAYMENT_CONNECTIPS_PRIVATE_KEY=/path/to/private.pem
NEPAL_PAYMENT_CONNECTIPS_PRIVATE_KEY_PASSPHRASE=optional_passphrase
NEPAL_PAYMENT_CONNECTIPS_PASSWORD=your_password

NEPAL_PAYMENT_LOGGING_ENABLED=true
NEPAL_PAYMENT_IDEMPOTENCY_ENABLED=true
NEPAL_PAYMENT_IDEMPOTENCY_TTL=86400

NEPAL_PAYMENT_STRIPE_ENABLED=false
NEPAL_PAYMENT_STRIPE_SECRET=your_stripe_secret
```

Usage
-----

[](#usage)

All gateways are accessed via the `GatewayManager` service.

eSewa (payment + verify)

```
use Nutandc\NepalPaymentSuite\Services\GatewayManager;

$gateway = app(GatewayManager::class)->esewa();

$payment = $gateway->payment([
    'amount' => '1000',
    'tax_amount' => '0',
    'total_amount' => '1000',
    'transaction_uuid' => 'txn_123',
    'product_code' => 'YOUR_PRODUCT_CODE',
    'success_url' => route('esewa.success'),
    'failure_url' => route('esewa.failure'),
]);

// Auto-submit HTML form:
echo $payment->redirectForm();

$verify = $gateway->verify([
    'transaction_uuid' => 'txn_123',
    'total_amount' => '1000',
    'product_code' => 'YOUR_PRODUCT_CODE',
]);

if ($verify->isSuccess()) {
    // handle success
}
```

Khalti (payment + verify)

```
use Nutandc\NepalPaymentSuite\Services\GatewayManager;

$gateway = app(GatewayManager::class)->khalti();

$payment = $gateway->payment([
    'return_url' => route('khalti.return'),
    'website_url' => config('app.url'),
    'amount' => 1000,
    'purchase_order_id' => 'order_123',
    'purchase_order_name' => 'Order #123',
]);

return redirect()->away($payment->redirectUrl());

$verify = $gateway->verify([
    'pidx' => 'pidx_123',
]);
```

ConnectIPS (payment + verify)

```
use Nutandc\NepalPaymentSuite\Services\GatewayManager;

$gateway = app(GatewayManager::class)->connectIps();

$payment = $gateway->payment([
    'transaction_id' => 'txn_123',
    'transaction_amount' => 1000,
    'remarks' => 'Order payment',
    'particulars' => 'Order #123',
    'reference_id' => 'ref_123',
    'success_url' => route('connectips.success'),
    'failure_url' => route('connectips.failure'),
]);

echo $payment->redirectForm();

$verify = $gateway->verify([
    'reference_id' => 'ref_123',
    'transaction_amount' => 1000,
]);
```

Stripe (optional)
-----------------

[](#stripe-optional)

Install the Stripe SDK and enable the gateway:

```
composer require stripe/stripe-php
```

```
NEPAL_PAYMENT_STRIPE_ENABLED=true
NEPAL_PAYMENT_STRIPE_SECRET=sk_test_xxx
```

Usage (amount is in the smallest currency unit, e.g. cents):

```
use Nutandc\NepalPaymentSuite\Services\GatewayManager;

$gateway = app(GatewayManager::class)->stripe();

$payment = $gateway->payment([
    'amount' => 1500,
    'currency' => 'usd',
    'product_name' => 'Subscription',
    'success_url' => route('stripe.success'),
    'cancel_url' => route('stripe.cancel'),
]);

return redirect()->away($payment->redirectUrl());
```

Idempotency
-----------

[](#idempotency)

Pass a custom idempotency key for any payment call:

```
$gateway->payment($payload, 'order-123');
```

Testing
-------

[](#testing)

```
composer install
composer test
composer analyse
composer fix:dry
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance76

Regular maintenance activity

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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 ~0 days

Total

3

Last Release

129d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f40665aea93e2d934f5efbec1457ddef646386850e51e7ee8891606cb4ef44b9?d=identicon)[Nutandc](/maintainers/Nutandc)

---

Tags

laravelstripepaymentgatewaykhaltiesewanepalConnectIps

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nutandc-nepal-payment-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/nutandc-nepal-payment-gateway/health.svg)](https://phpackages.com/packages/nutandc-nepal-payment-gateway)
```

###  Alternatives

[dena-a/iran-payment

a Laravel package to handle Internet Payment Gateways for Iran Banking System

312.4k1](/packages/dena-a-iran-payment)[parsisolution/gateway

A Laravel package for connecting to all Iraninan payment gateways

231.7k](/packages/parsisolution-gateway)

PHPackages © 2026

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