kbk/nepali-payment-gateway 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kbk/nepali-payment-gateway

Composer 安装命令:

composer require kbk/nepali-payment-gateway

包简介

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

README 文档

README

X (formerly Twitter) Facebook PHP Version Downloads License Packagist

A PHP library for integrating major Nepali payment gateways.

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:

Requirements

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

Installation

composer require kbk/nepali-payment-gateway

Getting Started

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

Usage

1) eSewa Payment Gateway

1.1 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

$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

2) Khalti Payment Gateway

2.1 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

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

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

Learn More at Khalti Payment Gateway Docs

3) ConnectIps Payment Gateway

3.1 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

$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

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 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.

kbk/nepali-payment-gateway 适用场景与选型建议

kbk/nepali-payment-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 8, 最近一次更新时间为 2025 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「payment」 「gateway」 「esewa」 「khalti」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kbk/nepali-payment-gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kbk/nepali-payment-gateway 我们能提供哪些服务?
定制开发 / 二次开发

基于 kbk/nepali-payment-gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 30
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-15