createch/paycorp-sampath-vault
Composer 安装命令:
composer require createch/paycorp-sampath-vault
包简介
Paycorp Sampath bank IPG package for Vault realtime payment
README 文档
README
Paycorp-Sampath-Vault is a php package for making payment using Sampath bank Payment Gateway in Laravel and PHP Projects. This uses the PHP library of Sampath bank. In this package you can make:
- Redirect Page Payment
- Realtime Payment
- Tokanized Payments
Features!
- Using with composer
- Easy intergration
- Compatible with Laravel
Requirements
PHP >= 5.6 OpenSSL >= 1.0.1 CUrl >= 7.34 Composer
Usage
Installation
$ composer require createch/paycorp-sampath-vault
Configurations
Laravel
After install via composer add Config values to .env file as following:
SAMPATH_SERVICE_ENDPOINT= SAMPATH_AUTHTOKEN= SAMPATH_HMAC= SAMPATH_CURRENCY= SAMPATH_TOKENIZE_CLIENT_ID= SAMPATH_PURCHASE_CLIENT_ID= SAMPATH_RETURN_URL=
Methods
PaymentInit
Import package class in you class header:
use createch\PaycorpSampathVault\PaycorpSampathVault;
Sample InitRequest
$paymentInit = new PaycorpSampathVault(); $data['clientRef'] = $request->user()->id; $data['comment'] = "Your comment"; $data['total_amount'] = 1010; $data['service_fee_amount'] = 1010; $data['payment_amount'] = 1010; $res = $paymentInit->initRequest($data); return response()->json($res);
You will receive reqid, payment_page_url for the redirect. When you redirected to the "payment_page_url" user can enter the card details and pay. Then paycorp will return the response to "SAMPATH_RETURN_URL" you configured in .env file. When get the correct response, you need to call PaymentCompleteRequest.
completeRequest
$data['reqid'] = $_GET['reqid']; $data['clientRef'] = $_GET['clientRef']; $paymentComplete = new PaycorpSampathVault(); $response = $paymentComplete->completeRequest($data); return response()->json($res);
Make Real Time Payments using Token
In Payment complete response you will get the "Token" and neccessary data. Using "Token" you can make instant payments without entering card details or redirecting user everytime to payment page. This is the special feature of Vault in paycorp.
$payment = new PaycorpSampathVault(); $data = []; $data['clientRef'] = "Clent Ref"; $data['token'] = "token"; $data['comment'] = "Your Comment"; $data['amount'] = 1010; // in cents $data['expire_at'] = "Expiry Date of Card"; //1223 $data['payment_amount'] = 1010; $response = $payment->realTimePayment($data); return $response;
NOTE:
Please read Paycorp Technical document and understand the workflow well before use this package. This package only for developers to save their life.
License
MIT
Free Software, Hell Yeah!
createch/paycorp-sampath-vault 适用场景与选型建议
createch/paycorp-sampath-vault 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.13k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 createch/paycorp-sampath-vault 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 createch/paycorp-sampath-vault 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-11