kbk/nepali-payment-gateway
最新稳定版本:1.0.2
Composer 安装命令:
composer require kbk/nepali-payment-gateway
包简介
Nepali Payment Gateway integration in PHP language. It includes eSewa, Khalti, ConnectIps, etc.
README 文档
README
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-curlext-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
mainbranch. - Thank you for your support and contributions. Looking forward to reviewing your code.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-15