xxtime / paytime
移动支付SDK,Apple Pay,Google Pay,Alipay,Paypal,mycard,mol,paymentwall
0.8.0
2017-05-26 09:01 UTC
Requires
- php: >=5.5.0
- lokielse/omnipay-alipay: ~2
- omnipay/paypal: ~2
- paymentwall/paymentwall-php: ~2
- symfony/http-foundation: ~2|~3
This package is auto-updated.
Last update: 2024-11-15 16:39:51 UTC
README
PayTime移动支付SDK,
- 规范优雅命名
- 符合PSR标准
- 支持多种网关支付
支持的网关
- Apple Pay
- Google Pay
- Alipay
- WeixinPay (待开发)
- Paypal
- Mol
- MyCard
- Paymentwall
子网关参数
- Alipay支付宝
- wap - 网页支付
- app - APP SDK支付
- PayPal
- wps - 标准网页支付
- express - 快速支付,支持信用卡
- MyCard
- card - 卡类支付
- telecom - 电信类支付
- wallet - 会员钱包支付
- Mol
- 1 - MOLPoints E-Wallet
- 2 - Rixty E-Wallet / Prepaid Card
- 3 - MOLPoints Prepaid Card
- 7 - NganLuong Prepaid Card
- 8 - Easy2Pay Carrier Billing
- 9 - GameSultan E-Wallet
- 10 - MOLPay Credit Card
- 11 - PayPal E-Wallet
- 12 - FPX Online-Banking
- 13 - Maybank2U Online-Banking
- 14 - DragonPay Online-Banking
- 601 - AIS 12 Call Prepaid Card
- 602 - True Money Prepaid Card
- 603 - Happy Prepaid Card
- 605 - MOLPoints Prepaid Card
支持沙箱测试的网关
以下网关在回调时支持沙箱测试
- paymentwall(回调参数:is_test)
- paypal(回调参数:test_ipn)
所需环境
PHP >= 5.5
composer
安装
composer require "xxtime/paytime:dev-master"
使用方法
<?php use Xxtime\PayTime\PayTime; // 不同网关方法略有区别 // $payTime = new PayTime('Mycard_card'); $payTime = new PayTime('Alipay'); $payTime->setOption( array( 'app_id' => 123456, 'private_key' => '/path/to/privateKey.pem', 'public_key' => '/path/to/publicKey.pem', 'return_url' => 'http://host/returnUrl', 'notify_url' => 'http://host/notifyUrl', ); ); $payTime->purchase([ 'transactionId' => 2016121417340937383, 'amount' => 0.05, 'currency' => 'CNY', 'productId' => 'com.xxtime.product.1', 'productDesc' => '测试产品', 'custom' => '自定义', // 选填 'userId' => '123456' // 选填 ]); try { $response = $payTime->send(); // 个别渠道需要单独处理,例如:MyCard需要存储单号后跳转(其回调无单号) // start call service process, only MyCard can get here now // do something // end call if (isset($response['redirect'])) { $payTime->redirect(); } } catch (\Exception $e) { // TODO :: error log echo $e->getMessage(); }
回调方法
<?php use Xxtime\PayTime\PayTime; // 订单验证 $payTime = new PayTime('Alipay'); $response = $payTime->notify(); if (!$response->isSuccessful()) { exit('失败'); } echo '成功';
response返回方法:
关于项目
主页: https://github.com/xxtime/paytime
作者: https://www.xxtime.com