cuonghuynh/easypay2-laravel-5
Composer 安装命令:
composer require cuonghuynh/easypay2-laravel-5
包简介
Easypay2 Gateway
README 文档
README
Laravel
After updating composer, add the PackageServiceProvider to the providers array in config/app.php
CuongHuynh\EasyPay2\PackageServiceProvider::class,
You can optionally use the facade for shorter code. Add this to your facades:
'EasyPay2' => CuongHuynh\EasyPay2\Facades\EasyPay2Facade::class
Publish the config-file.
php artisan vendor:publish
You will have easypay2.php in config folder
Usage
EasyPay Flow
Settings
Switch to sandbox mode by set to true in config/easypay2.php
return [
'sandbox_flag' => true,
'sandbox' => [
'endpoint' => 'https://test.wirecard.com.sg/easypay2/paymentpage.do?',
'mid' => 'xxx',
'security_key' => 'xxx',
'security_seq' => 'xxx',
],
'live' => [
'endpoint' => 'url',
'mid' => 'xxx',
'security_key' => 'xxx',
'security_seq' => 'xxx',
]
];
- endpoint: The URL to receive transaction requests.
- mid: Merchant ID generated by WireCard.
- security_key: Security parameters.
- security_seq: Order to make hashed string, for example:
amt,ref,cur,mid,transtype
Make a Transaction
Set URL to receive payment status and return after customer make payment.
EasyPay2::set('statusurl', URL);
EasyPay2::set('returnurl', URL);
Set other payment parameters
-
Transaction type, use EPTransactionType class contains types
EasyPay2::set('transtype', EPTransactionType::SALE); -
Skip status page, that mean EasyPay will don't return status to Merchant website. Don't recommended.
EasyPay2::set('skipstatuspage', 'N'); -
Reference ID is unique value on a transaction. You can use helper in this package to create RefId.
EasyPay2::set('ref', EPHelper::uniqueStringRandom()); -
Total amount to pay
EasyPay2::set('amt', #.##); -
Finally, call the method to make request URL with number of munites for validity period
EasyPay2::makeTransaction(15); $requestUrl = EasyPay2::requestUrl();
Send Transaction
Use a Laravel helper to redirect customer to Payment page
return redirect($requestUrl);
Receive Payment status
This process totally in backend, customer can't see Status response. After customer do payment, EasyPay will send a POST request to statusurl with parameters (see workflow image).
In your controller, get all inputs
public function postEasyPayStatusResponse(Request $request)
{
$response = $request->all();
//...
- Check
TM_Signaturevalue in response is valid, formula ishashed string from security sequence + status + error + security key
For example, now security seq is amt,ref,cur,mid,transtype so full formula is
$mdHashed : hash512($amt, $ref, $cur, $mid, $transtype) . $status . $error . $security_key
$epSignature : get('TM_Signature')
Implement, cause Easypay make a new request so we need regenerate values for EasyPay instance. Upon security seq you will set parameters needed for the instance. In the case:
$status = $this->request->get('TM_Status');
$error = $this->request->get('TM_Error');
$security_key = EasyPay2::get('security_key');
EasyPay2::set('amt', $amtOfOldRefId);
EasyPay2::set('ref', $oldRefId);
EasyPay2::set('cur', $currencyOfOldRefId);
EasyPay2::set('transtype', $transtypeOfOldRefId);
$data = EasyPay2::getHashDataFromSecuritySeq() . $status . $error . $security_key;
$mdHashed = EPHelper::hashSha512($data);
$signature = $this->request->get('TM_Signature');
Check if $mdHashed is same $signature, the request is valid and make other steps.
Send Acknowledge Response
After check signature in status response, Merchant must to send ACK to EasyPay to confirm receiving request.
EasyPay2::set('ack', 'YES');
$requestUrl = EasyPay2::requestUrl();
Send REVERSAL / VOID request if don't receive status response
Content updating ...
License
This EasyPay2 for Laravel 5 is open-sourced software licensed under the MIT license
cuonghuynh/easypay2-laravel-5 适用场景与选型建议
cuonghuynh/easypay2-laravel-5 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「easypay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cuonghuynh/easypay2-laravel-5 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cuonghuynh/easypay2-laravel-5 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cuonghuynh/easypay2-laravel-5 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
EasyPay gateway for Omnipay payment processing library
PHP library to communicate with easypay.pt API
EasypayBundle for the Symfony Framework
PHP wrapper for integration with Easypay Payment System
Epay Bg gateway for Omnipay payment processing library
an integration for third party payment
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-03