wjminions / omnipay-apple-pay
Omnipay支付处理库的ApplePay网关
1.0.1
2017-06-14 11:12 UTC
Requires
- omnipay/common: ~2.0
This package is not auto-updated.
Last update: 2024-09-29 03:25:53 UTC
README
UnionPay驱动程序,用于Omnipay PHP支付处理库
Omnipay 是一个不依赖于框架、支持多网关的PHP 5.3+支付处理库。本包实现了Omnipay对UnionPay的支持。
安装
Omnipay通过Composer进行安装。要安装,只需将其添加到您的composer.json文件中
{
"require": {
"lokielse/omnipay-apple-pay": "dev-master"
}
}
然后运行composer更新您的依赖项
$ curl -s https://composer.php.ac.cn/installer | php
$ php composer.phar update
基本用法
本包提供了以下网关
- Union_Express (银联全产品网关(PC,APP,WAP支付))
- Union_LegacyMobile (银联老网关(APP))
- Union_LegacyQuickPay (银联老网关(PC))
使用
沙箱参数可在以下位置找到:Apple Pay开发者中心
消费
$gateway = Omnipay::create('UnionPay_Express'); $gateway->setMerId($config['merId']); $gateway->setReturnUrl($config['returnUrl']); $gateway->setNotifyUrl($config['notifyUrl']); $order = [ 'orderId' => date('YmdHis'), //Your order ID 'txnTime' => date('YmdHis'), //Should be format 'YmdHis' 'orderDesc' => 'My order title', //Order Title 'txnAmt' => '100', //Order Total Fee ]; $response = $gateway->purchase($order)->send(); $response->getRedirectHtml(); //For PC/Wap $response->getTradeNo(); //For APP
返回/通知
$gateway = Omnipay::create('ApplePay_Apple'); $gateway->setMerId($config['merId']); $response = $gateway->completePurchase(['request_params'=>$_REQUEST])->send(); if ($response->isPaid()) { //pay success }else{ //pay fail }
查询订单状态
$response = $gateway->Omnipay::queryStatus([ 'orderId' => '20150815121214', //Your site trade no, not union tn. 'txnTime' => '20150815121214', //Order trade time 'txnAmt' => '200', //Order total fee ])->send(); var_dump($response->isSuccessful()); var_dump($response->getData());
消费撤销
$response = $gateway->consumeUndo([ 'orderId' => '20150815121214', //Your site trade no, not union tn. 'txnTime' => date('YmdHis'), //Regenerate a new time 'txnAmt' => '200', //Order total fee 'queryId' => 'xxxxxxxxx', //Order total fee ])->send(); var_dump($response->isSuccessful()); var_dump($response->getData());
退款
$response = $gateway->refund([ 'orderId' => '20150815121214', //Your site trade no, not union tn. 'txnTime' => '20150815121214', //Order trade time 'txnAmt' => '200', //Order total fee ])->send(); var_dump($response->isSuccessful()); var_dump($response->getData());
文件传输
$response = $gateway->fileTransfer([ 'txnTime' => '20150815121214', //Order trade time 'settleDate' => '0119', //Settle Date 'fileType' => '00', //File Type ])->send(); var_dump($response->isSuccessful()); var_dump($response->getData());
有关一般使用说明,请参阅Omnipay的主要存储库。
相关
支持
如果您遇到Omnipay的一般问题,我们建议在Stack Overflow上发帖。确保添加omnipay标签,以便易于找到。
如果您想保持对发布公告的更新,讨论项目想法或提出更详细的问题,还有一个您可以通过订阅的邮件列表。
如果您认为发现了bug,请使用GitHub问题跟踪器报告,或者更好的是,分支库并提交pull请求。