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
统计信息
- 总下载量: 113
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-04