yubarajshrestha/nchl
Composer 安装命令:
composer require yubarajshrestha/nchl
包简介
Connect IPS payment gateway for laravel.
README 文档
README
Connect IPS payment gateway package.
Installation
Require this package with composer.
composer require yubarajshrestha/nchl
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Laravel 5.5+:
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
YubarajShrestha\NCHL\NchlServiceProvider::class,
If you want to use the facade to log messages, add this to your facades in app.php:
'NCHL' => YubarajShrestha\NCHL\Facades\NchlFacade::class,
Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="YubarajShrestha\NCHL\NchlServiceProvider"
Copy the environment variables and setup as per required in .env:
NCHL_MERCHANT_ID= NCHL_APP_ID= NCHL_APP_NAME= NCHL_APP_PASSWORD= NCHL_GATEWAY= NCHL_VALIDATION_URL= NCHL_TRANSACTION_DETAIL_URL=
Basic Usage
A NCHL is Service Class and can be instanciated like this:
// In Controller $nchl = NCHL::__init([ "txn_id" => '3', "txn_date" => '1-10-2020', "txn_amount" => '500', "reference_id" => 'REF-001', "remarks" => 'RMKS-001', "particulars" => 'PART-001', ]);
And then in view you will create a form to start payment, which redirects you to Connect IPS.
// In View <form action="{{ $nchl->core->gatewayUrl() }}" method="post"> <label>MERCHANT ID</label> <input type="text" name="MERCHANTID" id="MERCHANTID" value="{{ $nchl->core->getMerchantId() }}"/> <label>APP ID</label> <input type="text" name="APPID" id="APPID" value="{{ $nchl->core->getAppId() }}"/> <label>APP NAME</label> <input type="text" name="APPNAME" id="APPNAME" value="{{ $nchl->core->getAppName() }}"/> <label>TXN ID</label> <input type="text" name="TXNID" id="TXNID" value="{{ $nchl->core->getTxnId() }}"/> <label>TXN DATE</label> <input type="text" name="TXNDATE" id="TXNDATE" value="{{ $nchl->core->getTxnDate() }}"/> <label>TXN CRNCY</label> <input type="text" name="TXNCRNCY" id="TXNCRNCY" value="{{ $nchl->core->getCurrency() }}"/> <label>TXN AMT</label> <input type="text" name="TXNAMT" id="TXNAMT" value="{{ $nchl->core->getTxnAmount() }}"/> <label>REFERENCE ID</label> <input type="text" name="REFERENCEID" id="REFERENCEID" value="{{ $nchl->core->getReferenceId() }}"/> <label>REMARKS</label> <input type="text" name="REMARKS" id="REMARKS" value="{{ $nchl->core->getRemarks() }}"/> <label>PARTICULARS</label> <input type="text" name="PARTICULARS" id="PARTICULARS" value="{{ $nchl->core->getParticulars() }}"/> <label>TOKEN</label> <input type="text" name="TOKEN" id="TOKEN" value="{{ $nchl->core->token() }}"/> <input type="submit" value="Submit"> </form>
After success or failure payment it will redirect you to the redirect url that you've provided to Connect IPS.
Validating Payment and retrieving Payment Details
Re-instantiate the NCHL serivce class same like before.
// In Controller $nchl = NCHL::__init([ "txn_id" => '3', "txn_date" => '1-10-2020', "txn_amount" => '500', "reference_id" => 'REF-001', "remarks" => 'RMKS-001', "particulars" => 'PART-001', ]); /** Validating Payment **/ $response = $nchl->paymentValidate(); /** Retrieving payment details **/ $response = $nchl->paymentDetails();
Well that's it. Enjoy
Contributors
Yubaraj Shrestha |
License
yubarajshrestha/nchl 适用场景与选型建议
yubarajshrestha/nchl 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 113 次下载、GitHub Stars 达 8, 最近一次更新时间为 2020 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 yubarajshrestha/nchl 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yubarajshrestha/nchl 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 113
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-04