OmniPay 多网关支付处理的框架
最后更新于:2022-04-02 02:24:16
[TOC]
## 概述
[omnipay-paypal](https://github.com/thephpleague/omnipay-paypal) - PayPal 支付
[omnipay-wechatpay](https://github.com/lokielse/omnipay-wechatpay) - 微信支付
[omnipay-unionpay](https://github.com/lokielse/omnipay-unionpay) - 银联支付
[omnipay-alipay](https://github.com/lokielse/omnipay-alipay) - 支付宝支付
[omnipay-pingpp](https://github.com/phoenixg/omnipay-pingpp) - ping++聚合支付
## omnipay-alipay
### 安装
`composer require lokielse/omnipay-alipay
`
### 接口说明
| Gateway | Description | 说明 | Links |
| :-- | :-- | :-- | :-: |
| Alipay\_AopPage | Alipay Page Gateway | 电脑网站支付 - new | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-Page-Gateway)[Doc](https://doc.open.alipay.com/doc2/detail.htm?treeId=270&articleId=105901&docType=1) |
| Alipay\_AopApp | Alipay APP Gateway | APP支付 - new | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-APP-Gateway)[Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=204&articleId=105051&docType=1) |
| Alipay\_AopF2F | Alipay Face To Face Gateway | 当面付 - new | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-Face-To-Face-Gateway)[Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=194&articleId=105072&docType=1) |
| Alipay\_AopWap | Alipay WAP Gateway | 手机网站支付 - new | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-WAP-Gateway)[Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=203&articleId=105288&docType=1) |
| Alipay\_AopJs | Alipay Js Gateway | JSAPI - new | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-JS-Gateway)[Doc](https://myjsapi.alipay.com/jsapi/native/trade-pay.html) |
| Alipay\_LegacyApp | Alipay Legacy APP Gateway | APP支付 | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Legacy-APP-Gateway)[Doc](https://doc.open.alipay.com/doc2/detail?treeId=59&articleId=103563&docType=1) |
| Alipay\_LegacyExpress | Alipay Legacy Express Gateway | 即时到账 | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Legacy-Express-Gateway)[Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=108&articleId=103950&docType=1) |
| Alipay\_LegacyWap | Alipay Legacy WAP Gateway | 手机网站支付 | [Usage](https://github.com/lokielse/omnipay-alipay/wiki/Legacy-WAP-Gateway)[Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=60&articleId=103564&docType=1) |
### 案例
```
/**
* @var AopAppGateway $gateway
*/
$gateway = Omnipay::create('Alipay_AopPage');
$gateway->setSignType('RSA2'); // RSA/RSA2/MD5
$gateway->setAppId('the_app_id');
$gateway->setPrivateKey('the_app_private_key');
$gateway->setAlipayPublicKey('the_alipay_public_key');
$gateway->setReturnUrl('https://www.example.com/return');
$gateway->setNotifyUrl('https://www.example.com/notify');
/**
* @var AopTradePagePayResponse $response
*/
$response = $gateway->purchase()->setBizContent([
'subject' => 'test',
'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999),
'total_amount' => '0.01',
'product_code' => 'FAST_INSTANT_TRADE_PAY',
])->send();
$url = $response->getRedirectUrl();
```
';