Skip to content

平台收付通-请求及查询分账结果

请求分账

微信订单支付成功后,由电商平台发起分账请求,将结算后的资金分给分账接收方。

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring公众账号ID
sub_mchidstring二级商户号
transaction_idstring微信订单号
out_order_nostring商户分账单号
receiversobject[]分账接收方列表
typestring分账接收方类型
receiver_accountstring分账接收方账号
amountinteger分账金额
descriptionstring分账描述
finishboolean是否分账完成
php
$instance->v3->ecommerce->profitsharing->orders->postAsync([
  'json' => [
    'appid'          => 'wx8888888888888888',
    'sub_mchid'      => '1900000109',
    'transaction_id' => '4208450740201411110007820472',
    'out_order_no'   => 'P20150806125346',
    'receivers'      => [[
      'type'             => 'MERCHANT_ID',
      'receiver_account' => '1900000109',
      'amount'           => 190,
      'description'      => '分给商户1900000109',
    ],],
    'finish'         => true,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/ecommerce/profitsharing/orders')->postAsync([
  'json' => [
    'appid'          => 'wx8888888888888888',
    'sub_mchid'      => '1900000109',
    'transaction_id' => '4208450740201411110007820472',
    'out_order_no'   => 'P20150806125346',
    'receivers'      => [[
      'type'             => 'MERCHANT_ID',
      'receiver_account' => '1900000109',
      'amount'           => 190,
      'description'      => '分给商户1900000109',
    ],],
    'finish'         => true,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/ecommerce/profitsharing/orders']->postAsync([
  'json' => [
    'appid'          => 'wx8888888888888888',
    'sub_mchid'      => '1900000109',
    'transaction_id' => '4208450740201411110007820472',
    'out_order_no'   => 'P20150806125346',
    'receivers'      => [[
      'type'             => 'MERCHANT_ID',
      'receiver_account' => '1900000109',
      'amount'           => 190,
      'description'      => '分给商户1900000109',
    ],],
    'finish'         => true,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->ecommerce->profitsharing->orders->post([
  'json' => [
    'appid'          => 'wx8888888888888888',
    'sub_mchid'      => '1900000109',
    'transaction_id' => '4208450740201411110007820472',
    'out_order_no'   => 'P20150806125346',
    'receivers'      => [[
      'type'             => 'MERCHANT_ID',
      'receiver_account' => '1900000109',
      'amount'           => 190,
      'description'      => '分给商户1900000109',
    ],],
    'finish'         => true,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ecommerce/profitsharing/orders')->post([
  'json' => [
    'appid'          => 'wx8888888888888888',
    'sub_mchid'      => '1900000109',
    'transaction_id' => '4208450740201411110007820472',
    'out_order_no'   => 'P20150806125346',
    'receivers'      => [[
      'type'             => 'MERCHANT_ID',
      'receiver_account' => '1900000109',
      'amount'           => 190,
      'description'      => '分给商户1900000109',
    ],],
    'finish'         => true,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ecommerce/profitsharing/orders']->post([
  'json' => [
    'appid'          => 'wx8888888888888888',
    'sub_mchid'      => '1900000109',
    'transaction_id' => '4208450740201411110007820472',
    'out_order_no'   => 'P20150806125346',
    'receivers'      => [[
      'type'             => 'MERCHANT_ID',
      'receiver_account' => '1900000109',
      'amount'           => 190,
      'description'      => '分给商户1900000109',
    ],],
    'finish'         => true,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
sub_mchidstring二级商户号
transaction_idstring微信订单号
out_order_nostring商户分账单号
order_idstring微信分账单号

参阅 官方文档

查询分账结果

发起分账请求后,可调用此接口查询分账结果 ;发起分账完结请求后,可调用此接口查询分账完结的结果。

请求参数类型描述
queryobject声明请求的查询参数
sub_mchidstring二级商户号
transaction_idstring微信订单号
out_order_nostring商户分账单号
php
$instance->v3->ecommerce->profitsharing->orders->getAsync([
  'query' => [
    'sub_mchid'      => '',
    'transaction_id' => '',
    'out_order_no'   => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/ecommerce/profitsharing/orders')->getAsync([
  'query' => [
    'sub_mchid'      => '',
    'transaction_id' => '',
    'out_order_no'   => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/ecommerce/profitsharing/orders']->getAsync([
  'query' => [
    'sub_mchid'      => '',
    'transaction_id' => '',
    'out_order_no'   => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->ecommerce->profitsharing->orders->get([
  'query' => [
    'sub_mchid'      => '',
    'transaction_id' => '',
    'out_order_no'   => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ecommerce/profitsharing/orders')->get([
  'query' => [
    'sub_mchid'      => '',
    'transaction_id' => '',
    'out_order_no'   => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ecommerce/profitsharing/orders']->get([
  'query' => [
    'sub_mchid'      => '',
    'transaction_id' => '',
    'out_order_no'   => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
sub_mchidstring二级商户号
transaction_idstring微信订单号
out_order_nostring商户分账单号
order_idstring微信分账单号
statusstring分账单状态
receiversobject[]分账接收方列表
receiver_mchidstring分账接收商户号
amountinteger分账金额
descriptionstring分账描述
resultstring分账结果
finish_timestring完成时间
fail_reasonstring分账失败原因
typestring分账接收方类型
receiver_accountstring分账接收方账号
close_reasonstring关单原因描述,当分账单状态status为CLOSED(处理失败,已关单)时,返回该字段。
finish_amountinteger分账完结的分账金额,单位为分, 仅当查询分账完结的执行结果时,存在本字段。
finish_descriptionstring分账完结的原因描述,仅当查询分账完结的执行结果时,存在本字段。

参阅 官方文档

Published on the GitHub by TheNorthMemory