Skip to content

Commit

Permalink
add h5 api
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy authored and Andy committed Sep 11, 2020
1 parent defe788 commit 3e5c87b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 10 deletions.
28 changes: 28 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@ $data = [
return Payjs::jsapi($data);
```

- H5支付

```php
// 构造订单基础信息
$data = [
'body' => '订单测试', // 订单标题
'total_fee' => 2, // 订单金额
'out_trade_no' => time(), // 订单号
'attach' => 'test_order_attach', // 订单附加信息(可选参数)
'notify_url' => 'https://www.baidu.com/notify', // 异步通知地址(可选参数)
'callback_url' => 'https://www.baidu.com', // 前端跳转地址(可选参数)
];
return Payjs::mweb($data);
```

- 投诉查询

```php
// 构造订单基础信息
$data = [
'mchid' => '123123', // 商户号
];
return Payjs::complaint($data);
```

- 查询订单

```php
Expand Down Expand Up @@ -161,6 +186,9 @@ Log::info($notify_info);
```

## 更新日志
Version 1.5.0
增加投诉API、H5支付API

Version 1.4
修正空值参数的过滤问题

Expand Down
40 changes: 30 additions & 10 deletions src/Payjs.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,29 @@ class Payjs
private $api_url_user;
private $api_url_info;
private $api_url_bank;
private $api_url_jsapi;
private $api_url_facepay;
private $api_url_complaint;
private $api_url_mweb;

public function __construct()
{
$this->mchid = config('payjs.mchid');
$this->key = config('payjs.key');
$api_url = config('payjs.api_url');

$this->api_url_native = $api_url . 'native';
$this->api_url_cashier = $api_url . 'cashier';
$this->api_url_refund = $api_url . 'refund';
$this->api_url_close = $api_url . 'close';
$this->api_url_check = $api_url . 'check';
$this->api_url_user = $api_url . 'user';
$this->api_url_info = $api_url . 'info';
$this->api_url_bank = $api_url . 'bank';
$this->api_url_jsapi = $api_url . 'jsapi';
$this->api_url_facepay = $api_url . 'facepay';
$this->api_url_native = $api_url . 'native';
$this->api_url_cashier = $api_url . 'cashier';
$this->api_url_refund = $api_url . 'refund';
$this->api_url_close = $api_url . 'close';
$this->api_url_check = $api_url . 'check';
$this->api_url_user = $api_url . 'user';
$this->api_url_info = $api_url . 'info';
$this->api_url_bank = $api_url . 'bank';
$this->api_url_jsapi = $api_url . 'jsapi';
$this->api_url_facepay = $api_url . 'facepay';
$this->api_url_complaint = $api_url . 'complaint';
$this->api_url_mweb = $api_url . 'mweb';
}

// 扫码支付
Expand Down Expand Up @@ -71,6 +77,20 @@ public function facepay(array $data)
return $this->post($data);
}

// 投诉订单
public function complaint(array $data)
{
$this->url = $this->api_url_complaint;
return $this->post($data);
}

// MWEB(H5) 支付
public function mweb(array $data)
{
$this->url = $this->api_url_mweb;
return $this->post($data);
}

// 关闭订单
public function close($payjs_order_id)
{
Expand Down

0 comments on commit 3e5c87b

Please sign in to comment.