Skip to content

Commit

Permalink
Merge 54fff6c into b423068
Browse files Browse the repository at this point in the history
  • Loading branch information
fage1151 committed Apr 25, 2019
2 parents b423068 + 54fff6c commit 6eddd87
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ QQ交流群:690027516
- 扫码支付
- 账户转账
- 小程序支付
- jsapi支付

| method | 描述 |
| :-------: | :-------: |
Expand All @@ -62,6 +63,7 @@ QQ交流群:690027516
| scan | 扫码支付 |
| transfer | 帐户转账 |
| mini | 小程序支付 |
| js | jsapi支付 |

### 2、微信
- 公众号支付
Expand Down
24 changes: 24 additions & 0 deletions docs/alipay/pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| scan | 扫码支付 | array $order | Collection |
| transfer | 账户转账 | array $order | Collection |
| mini | 小程序支付 | array $order | Collection |
| js | jsapi支付 | array $order | Collection |

# 使用方法

Expand Down Expand Up @@ -181,6 +182,29 @@ $result = $alipay->mini($order);

小程序支付接入文档:[https://docs.alipay.com/mini/introduce/pay](https://docs.alipay.com/mini/introduce/pay)

## 八、jsapi支付

### 例子

```PHP
$order = [
'out_trade_no' => time(),
'subject' => 'test subject-jsapi支付',
'total_amount' => '0.01',
'buyer_id' => 2088622190161234,
];

$result = $alipay->js($order);
```

### 订单配置参数

**所有订单配置中,客观参数均不用配置,扩展包已经为大家自动处理了,比如,**`product_code`** 等参数。**

所有订单配置参数和官方无任何差别,兼容所有功能,所有参数请参考[这里](https://docs.open.alipay.com/api_1/alipay.trade.create/),查看「请求参数」一栏。

jsapi支付轻便模式接入文档:[https://myjsapi.alipay.com/jsapi/native/trade-pay.html](https://myjsapi.alipay.com/jsapi/native/trade-pay.html)

# 返回值

**各支付方法返回值请参考「支持的支付方法」一节。**
Expand Down
1 change: 1 addition & 0 deletions src/Gateways/Alipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* @method Response wap(array $config) 手机网站支付
* @method Response web(array $config) 电脑支付
* @method Collection mini(array $config) 小程序支付
* @method Collection js(array $config) jsapi支付
*/
class Alipay implements GatewayApplicationInterface
{
Expand Down
14 changes: 14 additions & 0 deletions src/Gateways/Alipay/JsGateway.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Yansongda\Pay\Gateways\Alipay;

use Yansongda\Supports\Collection;

class JsGateway extends MiniGateway
{
public function pay($endpoint, array $payload): Collection
{
$pay_request['tradeNO'] = parent::pay($endpoint, $payload)->get('trade_no');
return new Collection($pay_request);
}
}

0 comments on commit 6eddd87

Please sign in to comment.