nujan / esewa
将 eSewa 支付网关无缝集成到 Laravel 项目中的包。
v1.0.0
2024-05-04 07:40 UTC
README
此包提供将 eSewa 支付网关无缝集成到 Laravel 项目的功能。
安装
您可以通过 composer 安装此包
composer require nujan/esewa:@dev
安装包后,发布配置文件
php artisan vendor:publish --provider="Nujan\Esewa\EsewaServiceProvider"
这将会在您的 config
目录中创建一个 esewa.php
配置文件。
配置
环境变量 ESEWA_MERCHANT_CODE
、ESEWA_SECRET
和 ESEWA_API_ENDPOINT
应在您的 .env
文件中设置
ESEWA_MERCHANT_CODE=your_merchant_code ESEWA_SECRET=your_secret_key ESEWA_API_ENDPOINT=your_api_endpoint
使用方法
以下是一个基本的使用示例
use Nujan\Esewa\Esewa; $esewa = new Esewa(); $data = [ 'amount' => 100, 'tax_amount' => 10, 'total_amount' => 110, 'transaction_uuid' => uniqid(mt_rand(), true), 'product_code' => 'EPAYTEST', 'product_service_charge' => 0, 'product_delivery_charge' => 0, 'success_url' => 'http://review.test/esewa/success', 'failure_url' => 'https://google.com', 'signed_field_names' => 'total_amount,transaction_uuid,product_code', ]; $response = $esewa->sendPaymentRequest($data); // Handle the response as needed
许可
MIT 许可证(MIT)。有关更多信息,请参阅 许可文件。
Please replace `your_merchant_code`, `your_secret_key`, and `your_api_endpoint` with your actual eSewa merchant code, secret key, and API endpoint.