请求多次分账
微信订单支付成功后,服务商代子商户发起分账请求,将结算后的钱分到分账接收方。多次分账请求仅会按照传入的分账接收方进行分账,不会对剩余的金额进行任何操作。故操作成功后,在待分账金额不等于零时,订单依旧能够再次进行分账。● 多次分账,可以将本商户作为分账接收方直接传入,实现释放资金给本商户的功能。
请求参数 | 类型 | 描述 |
---|---|---|
security | true | 声明加载商户API证书 |
xml | object | 声明请求的XML 数据结构 |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
appid | string | 公众账号ID |
sub_appid | string | 子商户公众账号ID |
sign_type | string | 签名类型HMAC-SHA256 枚举值 |
transaction_id | string | 微信订单号 |
out_order_no | string | 商户分账单号 |
receivers | string | 分账接收方列表JSON 格式字符串 |
receiver | object[] | 分账接收方列表JSON 表达式 |
type | string | 分账接收方类型MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一 |
account | string | 分账接收方账号 |
amount | number | 分账金额 |
description | string | 分账描述 |
name | string | 分账个人接收方姓名 |
php
$instance->v2->secapi->pay->multiprofitsharing->postAsync([
'security' => true,
'xml' => [
'mch_id' => '1900000100',
'sub_mch_id' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'sign_type' => 'HMAC-SHA256',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => '[{"type": "MERCHANT_ID","account": "190001001","amount": 100,"description": "分到商户"}, {"type": "PERSONAL_OPENID","account": "86693952","amount": 888,"description": "分到个人"}]',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/secapi/pay/multiprofitsharing')->postAsync([
'security' => true,
'xml' => [
'mch_id' => '1900000100',
'sub_mch_id' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'sign_type' => 'HMAC-SHA256',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => '[{"type": "MERCHANT_ID","account": "190001001","amount": 100,"description": "分到商户"}, {"type": "PERSONAL_OPENID","account": "86693952","amount": 888,"description": "分到个人"}]',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/secapi/pay/multiprofitsharing']->postAsync([
'security' => true,
'xml' => [
'mch_id' => '1900000100',
'sub_mch_id' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'sign_type' => 'HMAC-SHA256',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => '[{"type": "MERCHANT_ID","account": "190001001","amount": 100,"description": "分到商户"}, {"type": "PERSONAL_OPENID","account": "86693952","amount": 888,"description": "分到个人"}]',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->secapi->pay->multiprofitsharing->post([
'security' => true,
'xml' => [
'mch_id' => '1900000100',
'sub_mch_id' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'sign_type' => 'HMAC-SHA256',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => '[{"type": "MERCHANT_ID","account": "190001001","amount": 100,"description": "分到商户"}, {"type": "PERSONAL_OPENID","account": "86693952","amount": 888,"description": "分到个人"}]',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/secapi/pay/multiprofitsharing')->post([
'security' => true,
'xml' => [
'mch_id' => '1900000100',
'sub_mch_id' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'sign_type' => 'HMAC-SHA256',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => '[{"type": "MERCHANT_ID","account": "190001001","amount": 100,"description": "分到商户"}, {"type": "PERSONAL_OPENID","account": "86693952","amount": 888,"description": "分到个人"}]',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/secapi/pay/multiprofitsharing']->post([
'security' => true,
'xml' => [
'mch_id' => '1900000100',
'sub_mch_id' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'sign_type' => 'HMAC-SHA256',
'transaction_id' => '4208450740201411110007820472',
'out_order_no' => 'P20150806125346',
'receivers' => '[{"type": "MERCHANT_ID","account": "190001001","amount": 100,"description": "分到商户"}, {"type": "PERSONAL_OPENID","account": "86693952","amount": 888,"description": "分到个人"}]',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典 | 类型 | 描述 |
---|---|---|
sub_appid | string | 子商户公众账号ID |
sub_mch_id | string | 子商户号 |
return_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
return_msg | string | 返回信息 |
appid | string | 公众账号ID |
mch_id | string | 商户号 |
nonce_str | string | 随机字符串 |
sign | string | 签名 |
result_code | string | 业务结果SUCCESS | FAIL 枚举值之一 |
err_code | string | 错误代码 |
err_code_des | string | 错误代码描述 |
transaction_id | string | 微信订单号 |
out_order_no | string | 商户分账单号 |
order_id | string | 微信分账单号 |
receivers | string | 分账接收方列表JSON 格式字符串 |
receiver | object[] | 分账接收方列表JSON 表达式 |
type | string | 分账接收方类型MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一 |
account | string | 分账接收方账号 |
amount | number | 分账金额 |
description | string | 分账描述 |
detail_id | string | 分账明细单号 |
finish_time | string | 分账完成时间 |
receiver_mchid | string | 分账接收商户号 |
result | string | 分账结果PENDING | SUCCESS | CLOSED 枚举值之一 |