PHPackages                             kbk/nepali-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. [API Development](/categories/api)
4. /
5. kbk/nepali-payment-gateway

ActiveLibrary[API Development](/categories/api)

kbk/nepali-payment-gateway
==========================

Nepali Payment Gateway integration in PHP language. It includes eSewa, Khalti, ConnectIps, etc.

1.0.2(4mo ago)82711MITPHPPHP ^8.1

Since Dec 15Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/aryanmalla19/nepali-payment-gateway)[ Packagist](https://packagist.org/packages/kbk/nepali-payment-gateway)[ Docs](https://github.com/aryanmalla19/nepali-payment-gateway)[ RSS](/packages/kbk-nepali-payment-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (11)Used By (1)

Nepali Payment Gateway
======================

[](#nepali-payment-gateway)

[![X (formerly Twitter)](https://camo.githubusercontent.com/a5c593e70fd93b7a11eba7584e7efe91cce5ce28fdd67b6b41f4e4bad0e836a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d40617279616e6d616c6c6131392d77686974653f7374796c653d666c6174266c6f676f3d78266c6162656c3d28666f726d65726c792532305477697474657229)](https://x.com/aryanmalla19)[![Facebook](https://camo.githubusercontent.com/3c9c0c85b2bbbd2e9b4928c3e1fa08aeec3c542947dd9c3edbe4146cdb024da9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46616365626f6f6b2d617279616e6d616c6c6131392d626c75653f7374796c653d666c6174266c6f676f3d66616365626f6f6b)](https://www.facebook.com/aryanmalla19)[![PHP Version](https://camo.githubusercontent.com/71f6292a0e3b5d84aefbce336d1370f8876c7943b504a2ffe22d307bb394272d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b626b2f6e6570616c692d7061796d656e742d67617465776179)](https://camo.githubusercontent.com/71f6292a0e3b5d84aefbce336d1370f8876c7943b504a2ffe22d307bb394272d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b626b2f6e6570616c692d7061796d656e742d67617465776179)[![Downloads](https://camo.githubusercontent.com/7efd235c60320515ff8293254af2566009988844bda6897df5dc30bfd48f7b33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b626b2f6e6570616c692d7061796d656e742d676174657761793f6c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/kbk/nepali-payment-gateway)[![License](https://camo.githubusercontent.com/96245d7a786245df3372b83630d30381b6c5ce6a64ea36067c3527596a77f1e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f617279616e6d616c6c6131392f6e6570616c692d7061796d656e742d67617465776179)](LICENSE)[![Packagist](https://camo.githubusercontent.com/9f46359e0b12e3aeb11d62c85611254c21e83e84a3c451e15e945ee82d547451/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b626b2f6e6570616c692d7061796d656e742d67617465776179)](https://packagist.org/packages/kbk/nepali-payment-gateway)

> A PHP library for integrating major Nepali payment gateways.

---

Introduction
------------

[](#introduction)

Nepali Payment Gateway is a PHP package designed to integrate major online payment systems in Nepal into any PHP-based application.
It provides a unified, clean, and developer-friendly interface for initiating and verifying payments across multiple providers.

Currently supported payment gateways:

- **eSewa**
- **Khalti**
- **ConnectIPS**

This package is developed and maintained by **Aryan Malla** along with the open-source community.

For gateway-specific rules, configurations, and policies, please refer to the official documentation provided by each payment partner:

- [Official eSewa Documentation](https://developer.esewa.com.np/)
- [Official Khalti Documentation](https://docs.khalti.com/)
- [Official ConnectIPS Documentation](https://doc.connectips.com/docs/category/2-connectips-gateway/)

---

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

[](#requirements)

- PHP **8.1** or higher
- Composer
- Required PHP extensions:
    - `ext-curl`
    - `ext-openssl`

---

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

[](#installation)

```
composer require kbk/nepali-payment-gateway

```

---

Getting Started
---------------

[](#getting-started)

```
require __DIR__ . '/vendor/autoload.php';
```

---

Usage
-----

[](#usage)

### 1) eSewa Payment Gateway

[](#1-esewa-payment-gateway)

#### 1.1 Payment Example

[](#11-payment-example)

```
use Kbk\NepaliPaymentGateway\Epay\Esewa;

$esewa = new Esewa([
    'product_code' => 'EPAYTEST',
    'secret_key'   => 'your-secret-key', // use "8gBm/:&EnhH.1/q" for test env
]);

$response = $esewa->payment([
    'amount'       => 1000,
    'success_url'  => 'https://example.com/success',
    'failure_url'  => 'https://example.com/failure',
]);

return $response->redirect();
```

---

#### 1.2 Payment Verification Example

[](#12-payment-verification-example)

```
$response = $esewa->verify([
    'total_amount' => 100,
    'transaction_uuid' => '123',
]);

if ($response->isSuccess()) {
    echo 'Payment Successful';
} else {
    echo 'Payment Failed';
}
```

Learn More at [eSewa Payment Gateway Docs](eSewa.md)

### 2) Khalti Payment Gateway

[](#2-khalti-payment-gateway)

#### 2.1 Payment Example

[](#21-payment-example)

```
use Kbk\NepaliPaymentGateway\Epay\Khalti;

$khalti = new Khalti(
  secretKey: 'your-secret-key',
  enviroment: 'test', // or 'live'
);

$response = $khalti->payment([
    'return_url' => 'https://example.com/success',
    'website_url' => 'https://example.com/failure',
    'amount' => 100, // in Rs.
    'purchase_order_id' => 'TEST01',
    'purchase_order_name' => 'TEST01',
]);

return $response->redirect();
```

#### 2.2 Payment Verification Example

[](#22-payment-verification-example)

```
$response = $khalti->verify([
    'pidx' => 'your-payment-index',
]);

if ($response->isSuccess()) {
    echo 'Payment Successful';
} else {
    echo 'Payment Failed';
}
```

Learn More at [Khalti Payment Gateway Docs](Khalti.md)

### 3) ConnectIps Payment Gateway

[](#3-connectips-payment-gateway)

#### 3.1 Payment Example

[](#31-payment-example)

```
use \Kbk\NepaliPaymentGateway\Epay\ConnectIps;

$connectIps = new ConnectIps([
    'base_url' => 'https://uat.connectips.com',
    'merchant_id' => 'your-merchant-id',
    'app_id' => 'your-app-id',
    'app_name' => 'your-app-name',
    'private_key_path' => 'your-private-key',
    'password' => 'your-password',
]);

$response = $connectIps->payment([
    'remarks' => 'your-remarks',
    'particulars' => 'your-particulars',
    'reference_id' => 'your-reference-id',
]);

return $response->redirect();
```

#### 3.2 Payment Verification Example

[](#32-payment-verification-example)

```
$response = $connectIps->verify([
    'reference_id' => 'your-reference-id',
    'transaction_amount' => 100, // in Rs.
]);

if ($response->isSuccess()) {
    echo 'Payment Successful';
} else {
    echo 'Payment Failed';
}
```

Learn More at [ConnectIps Payment Gateway Docs](ConnectIps.md)

---

Contribution
------------

[](#contribution)

The contributions of the Open Source community are highly valued and appreciated. To ensure a smooth and efficient process, please adhere to the following guidelines when submitting code:

- Ensure that the code adheres to [PER Coding Style 3.0](https://www.php-fig.org/per/coding-style/) standards.
- All submitted code must pass relevant tests.
- Proper documentation and clean code practices are essential.
- Please make pull requests to the `main` branch.
- Thank you for your support and contributions. Looking forward to reviewing your code.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance81

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

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

Total

10

Last Release

130d ago

Major Versions

v0.1.6 → v1.0.02025-12-31

### Community

Maintainers

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

---

Top Contributors

[![aryanmalla19](https://avatars.githubusercontent.com/u/84025233?v=4)](https://github.com/aryanmalla19 "aryanmalla19 (97 commits)")

---

Tags

phpapipaymentgatewaykhaltiesewanepalConnectIps

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kbk-nepali-payment-gateway/health.svg)

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

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

59914.4M62](/packages/mollie-mollie-api-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

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