请求分账
微信订单支付成功后,商户发起分账请求,将结算后的资金分到分账接收方。
| 请求参数 | 类型 | 描述 |
|---|---|---|
| base_uri | string | 声明接入点https://apihk.mch.weixin.qq.com/(香港接入) |
| json | object | 声明请求的JSON数据结构 |
| sub_mchid | string | 子商户号 |
| appid | string | 应用ID |
| sub_appid | string | 子商户应用ID |
| transaction_id | string | 微信订单号 |
| out_order_no | string | 商户分账单号 |
| receivers | object[] | 分账接收方列表 |
| currency | string | 分账币种CNY 枚举值 |
| type | string | 分账接收方类型MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一 |
| account | string | 分账接收方帐号 |
| name | string | 分账个人接收方姓名 |
| authorized | boolean | 是否已经获取用户实名信息授权 |
| amount | integer | 分账金额 |
| description | string | 分账描述 |
| unfreeze_unsplit | boolean | 是否解冻剩余未分资金 |
php
$instance->v3->global->profitSharing->orders->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'sub_mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888889',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => [[
'currency' => 'CNY',
'type' => 'MERCHANT_ID',
'account' => '86693852',
'name' => 'hu89ohu89ohu89o',
'authorized' => true,
'amount' => 888,
'description' => '分给商户A',
],],
'unfreeze_unsplit' => true,
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/global/profit-sharing/orders')->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'sub_mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888889',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => [[
'currency' => 'CNY',
'type' => 'MERCHANT_ID',
'account' => '86693852',
'name' => 'hu89ohu89ohu89o',
'authorized' => true,
'amount' => 888,
'description' => '分给商户A',
],],
'unfreeze_unsplit' => true,
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/global/profit-sharing/orders']->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'sub_mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888889',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => [[
'currency' => 'CNY',
'type' => 'MERCHANT_ID',
'account' => '86693852',
'name' => 'hu89ohu89ohu89o',
'authorized' => true,
'amount' => 888,
'description' => '分给商户A',
],],
'unfreeze_unsplit' => true,
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->global->profitSharing->orders->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'sub_mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888889',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => [[
'currency' => 'CNY',
'type' => 'MERCHANT_ID',
'account' => '86693852',
'name' => 'hu89ohu89ohu89o',
'authorized' => true,
'amount' => 888,
'description' => '分给商户A',
],],
'unfreeze_unsplit' => true,
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/global/profit-sharing/orders')->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'sub_mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888889',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => [[
'currency' => 'CNY',
'type' => 'MERCHANT_ID',
'account' => '86693852',
'name' => 'hu89ohu89ohu89o',
'authorized' => true,
'amount' => 888,
'description' => '分给商户A',
],],
'unfreeze_unsplit' => true,
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/global/profit-sharing/orders']->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'sub_mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888889',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => [[
'currency' => 'CNY',
'type' => 'MERCHANT_ID',
'account' => '86693852',
'name' => 'hu89ohu89ohu89o',
'authorized' => true,
'amount' => 888,
'description' => '分给商户A',
],],
'unfreeze_unsplit' => true,
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| sub_mchid | string | 子商户号 |
| transaction_id | string | 微信订单号 |
| out_order_no | string | 商户分账单号 |
| order_id | string | 微信分账单号 |
| state | string | 分账单状态 |
| receivers | object[] | 分账接收方列表 |
| currency | string | 分账币种 |
| amount | integer | 分账金额 |
| description | string | 分账描述 |
| type | string | 分账接收方类型MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一 |
| account | string | 分账接收方帐号 |
| result | string | 分账结果 |
| fail_reason | string | 分账失败原因 |
| create_time | string | 分账创建时间 |
| finish_time | string | 分账完成时间 |
| detail_id | string | 分账明细单号 |
| detail_type | string | 分账明细类型 |
| settlement_currency | string | 出资方结算币种 |
| settlement_amount | integer | 出资方结算金额 |
| rate | integer | 汇率值 |
参阅 官方文档