2017-08-09 09:04:28 +08:00
|
|
|
<h1 align="center">Pay</h1>
|
2017-08-09 08:54:15 +08:00
|
|
|
|
2017-08-14 21:58:24 +08:00
|
|
|
## 安装
|
2017-08-09 09:01:18 +08:00
|
|
|
```composer required yansongda/pay```
|
2017-08-09 08:54:15 +08:00
|
|
|
|
2017-08-14 21:58:24 +08:00
|
|
|
## 使用方法
|
|
|
|
### 1、支付宝
|
2017-08-09 08:54:15 +08:00
|
|
|
```php
|
|
|
|
use Yansongda\Pay\Pay;
|
|
|
|
|
|
|
|
$config = [
|
|
|
|
'alipay' => [
|
|
|
|
'app_id' => '',
|
2017-08-12 15:39:44 +08:00
|
|
|
'notify_url' => '',
|
|
|
|
'return_url' => '',
|
2017-08-09 08:54:15 +08:00
|
|
|
'ali_public_key' => '',
|
|
|
|
'private_key' => '',
|
|
|
|
],
|
|
|
|
];
|
2017-08-11 14:48:17 +08:00
|
|
|
$config_biz = [
|
2017-08-09 08:54:15 +08:00
|
|
|
'out_trade_no' => '',
|
|
|
|
'total_amount' => '',
|
|
|
|
'subject' => '',
|
|
|
|
];
|
|
|
|
|
|
|
|
$pay = new Pay($config);
|
2017-08-14 21:58:24 +08:00
|
|
|
return $pay->dirver('alipay')->gateway('web')->pay($config_biz);
|
|
|
|
```
|
|
|
|
|
|
|
|
### 2、微信
|
|
|
|
```php
|
|
|
|
use Yansongda\Pay\Pay;
|
|
|
|
|
|
|
|
$config = [
|
|
|
|
'wechat' => [
|
|
|
|
'app_id' => '',
|
|
|
|
'mch_id' => '',
|
2017-08-15 15:32:07 +08:00
|
|
|
'appid' => '',
|
2017-08-14 21:58:24 +08:00
|
|
|
'notify_url' => '',
|
2017-08-15 15:32:07 +08:00
|
|
|
'return_url' => '',
|
2017-08-15 12:32:21 +08:00
|
|
|
'key' => '',
|
2017-08-14 21:58:24 +08:00
|
|
|
],
|
|
|
|
];
|
|
|
|
$config_biz = [
|
|
|
|
'out_trade_no' => '',
|
|
|
|
'total_fee' => '',
|
|
|
|
'body' => '',
|
|
|
|
'spbill_create_ip' => '',
|
2017-08-15 12:32:21 +08:00
|
|
|
'openid' => '',
|
2017-08-14 21:58:24 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
$pay = new Pay($config);
|
|
|
|
return $pay->dirver('wechat')->gateway('js')->pay($config_biz);
|
2017-08-09 09:05:17 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
## LICENSE
|
|
|
|
MIT
|