Skip to content

请求单次分账

单次分账请求按照传入的分账接收方账号和资金进行分账,同时会将订单剩余的待分账金额解冻给特约商户。故操作成功后,订单不能再进行分账,也不能进行分账完结。

请求参数类型描述
securitytrue声明加载商户API证书
xmlobject声明请求的XML数据结构
mch_idstring商户号
sub_mch_idstring子商户号
brand_mch_idstring品牌主商户号
appidstring公众账号ID
sub_appidstring子商户公众账号ID
sign_typestring签名类型
HMAC-SHA256 枚举值
transaction_idstring微信订单号
out_order_nostring商户分账单号
receiversstring分账接收方列表JSON格式字符串
receiverobject[]分账接收方列表JSON表达式
typestring分账接收方类型
MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一
accountstring分账接收方账号
amountnumber分账金额
descriptionstring分账描述
namestring分账个人接收方姓名
php
$instance->v2->secapi->pay->profitsharing->postAsync([
  'security' => true,
  'xml' => [
    'mch_id'         => '1900000100',
    'sub_mch_id'     => '1900000109',
    'brand_mch_id'   => '1900000108',
    '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/profitsharing')->postAsync([
  'security' => true,
  'xml' => [
    'mch_id'         => '1900000100',
    'sub_mch_id'     => '1900000109',
    'brand_mch_id'   => '1900000108',
    '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/profitsharing']->postAsync([
  'security' => true,
  'xml' => [
    'mch_id'         => '1900000100',
    'sub_mch_id'     => '1900000109',
    'brand_mch_id'   => '1900000108',
    '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->profitsharing->post([
  'security' => true,
  'xml' => [
    'mch_id'         => '1900000100',
    'sub_mch_id'     => '1900000109',
    'brand_mch_id'   => '1900000108',
    '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/profitsharing')->post([
  'security' => true,
  'xml' => [
    'mch_id'         => '1900000100',
    'sub_mch_id'     => '1900000109',
    'brand_mch_id'   => '1900000108',
    '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/profitsharing']->post([
  'security' => true,
  'xml' => [
    'mch_id'         => '1900000100',
    'sub_mch_id'     => '1900000109',
    'brand_mch_id'   => '1900000108',
    '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_appidstring子商户公众账号ID
sub_mch_idstring子商户号
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
appidstring公众账号ID
mch_idstring商户号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
brand_mch_idstring品牌主商户号
transaction_idstring微信订单号
out_order_nostring商户分账单号
order_idstring微信分账单号
statusstring分账单状态
FINISHED | PROCESSING 枚举值之一
receiversstring分账接收方列表JSON格式字符串
receiverobject[]分账接收方列表JSON表达式
typestring分账接收方类型
MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一
accountstring分账接收方账号
amountnumber分账金额
descriptionstring分账描述
detail_idstring分账明细单号
finish_timestring分账完成时间
receiver_mchidstring分账接收商户号
resultstring分账结果
PENDING | SUCCESS | CLOSED 枚举值之一

参阅 官方文档 官方文档

Published on the GitHub by TheNorthMemory