ajaxy/payment
Composer 安装命令:
composer require ajaxy/payment
包简介
Ajaxy Payment
README 文档
README
Installation
composer require ajaxy/payment
Examples
//using paypal $__URL__ = 'http://www.example.com'; $paypal = new \Ajaxy\Payment\Gateway\Paypal(array( 'email' => '', 'custom' => array('user_id' => ''), 'notify_url' => $__URL__.'/validate_ipn.php', 'return_url' => $__URL__, 'cancel_return' => $__URL__ )); $paypal->addItem('test1', 10, 1); $paypal->addItem('test2', 10, 3); //print the form $paypal->getForm(true); //or echo the url echo '<a href="'.$paypal->getRequestUrl(false).'">Pay</a>'; //using al mashreq bank $__URL__ = "http://www.example.com"; $_SECURE_HASH_ = ''; //should be sent by the bank $_MID_ = ''; //merchant id $_ACCESS_CODE_ = ''; //access code $almashreq = new \Ajaxy\Payment\Gateway\AlMashreq(array( 'notify_url' => $__URL__.'/validate_mh.php', 'return_url' => $__URL__.'/validate_mh.php', 'order_number' => __ORDER__NO__, //pass any order info to the payment, you will receive this back 'custom' => array('test' => 1), //the order total, maximum of 2 decimal places 'total' => '321', //sandbox or live 'mode' => 'sandbox', //merchant details, those details are sent by the bank 'endpoint' => 'https://migs.mastercard.com.au', 'access_code' => $_ACCESS_CODE_, 'merchant' => $_MID_, 'currency_code' => 'AED', 'secure_hash' => $_SECURE_HASH_, )); //print the form $almashreq->getForm(true); //or echo the url echo '<a href="'.$almashreq->getRequestUrl(false, true).'">Pay</a>';
Validation
//you will receive the response at the return_url you have set before //al mashreq $response = new \Ajaxy\Payment\Gateway\AlMashreq\Response(_SECURE_HASH_, null); if($response->validate()){ $custom = $response->getCustom(); print_r($custom); echo 'payment is valid'; }else{ $code = $response->getResponseCode(); echo $response->getResultDescription($code); } //paypal $ipn = new \Ajaxy\Payment\Gateway\Paypal\IPN('php://input', true); if($ipn->validate()){ echo "valid"; }else{ echo "failed"; } //you can also pass a psr4 logger to log the response use \Ajaxy\Logger\Logger; use \Ajaxy\Logger\Handler\Stream; $log = new Logger(); $log->addHandler(new Stream(dirname(__FILE__).'/log/')); $ipn = new \Ajaxy\Payment\Gateway\Paypal\IPN('php://input', true, $log); $response = new \Ajaxy\Payment\Gateway\AlMashreq\Response(_SECURE_HASH_, null, $log);
About
Requirements
- Ajaxy\Logger works with PHP 5.6 or above.
Submitting bugs and feature requests
Bugs and feature request are tracked on GitHub
Author
Naji Amer - icu090@gmail.com - http://ajaxy.org
License
Ajaxy\Payment is licensed under the MIT License - see the LICENSE file for details
ajaxy/payment 适用场景与选型建议
ajaxy/payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ajaxy/payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ajaxy/payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-26