Skip to content

Commit

Permalink
fix: Add docs #2833
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Aug 19, 2024
1 parent 57bf4b2 commit 1ac8808
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/src/6.x/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,19 @@ $client->get('v3/pay/transactions/id/1217752501201407033233368018', [
不得不把商户号这种基础信息再读取传递一遍,比较麻烦,设计了如下的简化方案:

```php
$client->withMchId()->get('v3/pay/transactions/id/1217752501201407033233368018');
$client->withMchId()->get('endpoint');
// 结果:endpoint?mchid=xxxxx
```

注意:`withMchId` 默认产生的结果为:`mch_id`,因为微信支付官方的各种不统一, 可能有的场景你需要的不是 `mch_id` 而是 `mchid`, 可以通过 `withMchIdAs('mchid')` 来指定,比如:

```php
$client->withMchIdAs('mchid')->get('v3/pay/transactions/id/1217752501201407033233368018');
// 或者
$client->withMchid()->get('v3/pay/transactions/id/1217752501201407033233368018');

// 结果:v3/pay/transactions/id/1217752501201407033233368018?mchid=xxxxx
```
注意:`withMchId` 默认产生的结果为:`mch_id`,因为微信支付官方的各种不统一, 可能有的场景你需要的不是 `mch_id` 而是 `mchid`, 可以通过 `withMchIdAs('mchid')` 来指定。

原理就是 `with` + `配置 key`

Expand Down

0 comments on commit 1ac8808

Please sign in to comment.