Skip to content

分账回退

此功能需要接收方在商户平台-交易中心-分账-分账接收设置下,开启同意分账回退后,才能使用。分账回退的时限是180天。

请求参数类型描述
securitytrue声明加载商户API证书
xmlobject声明请求的XML数据结构
mch_idstring商户号
sub_mch_idstring子商户号
appidstring公众账号ID
sub_appidstring子商户公众账号ID
sign_typestring签名类型
HMAC-SHA256 枚举值
order_idstring微信分账单号
out_order_nostring商户分账单号
out_return_nostring商户回退单号
return_account_typestring回退方类型
MERCHANT_ID 枚举值
return_accountstring回退方账号
return_amountinteger回退金额
descriptionstring回退描述
php
$instance->v2->secapi->pay->profitsharingreturn->postAsync([
  'security' => true,
  'xml' => [
    'mch_id'              => '1900000100',
    'sub_mch_id'          => '1900000109',
    'appid'               => 'wx8888888888888888',
    'sub_appid'           => 'wx8888888888888888',
    'sign_type'           => 'HMAC-SHA256',
    'order_id'            => '3008450740201411110007820472',
    'out_order_no'        => 'P20150806125346',
    'out_return_no'       => 'R20190516001',
    'return_account_type' => 'MERCHANT_ID',
    'return_account'      => '86693852',
    'return_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/profitsharingreturn')->postAsync([
  'security' => true,
  'xml' => [
    'mch_id'              => '1900000100',
    'sub_mch_id'          => '1900000109',
    'appid'               => 'wx8888888888888888',
    'sub_appid'           => 'wx8888888888888888',
    'sign_type'           => 'HMAC-SHA256',
    'order_id'            => '3008450740201411110007820472',
    'out_order_no'        => 'P20150806125346',
    'out_return_no'       => 'R20190516001',
    'return_account_type' => 'MERCHANT_ID',
    'return_account'      => '86693852',
    'return_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/profitsharingreturn']->postAsync([
  'security' => true,
  'xml' => [
    'mch_id'              => '1900000100',
    'sub_mch_id'          => '1900000109',
    'appid'               => 'wx8888888888888888',
    'sub_appid'           => 'wx8888888888888888',
    'sign_type'           => 'HMAC-SHA256',
    'order_id'            => '3008450740201411110007820472',
    'out_order_no'        => 'P20150806125346',
    'out_return_no'       => 'R20190516001',
    'return_account_type' => 'MERCHANT_ID',
    'return_account'      => '86693852',
    'return_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->profitsharingreturn->post([
  'security' => true,
  'xml' => [
    'mch_id'              => '1900000100',
    'sub_mch_id'          => '1900000109',
    'appid'               => 'wx8888888888888888',
    'sub_appid'           => 'wx8888888888888888',
    'sign_type'           => 'HMAC-SHA256',
    'order_id'            => '3008450740201411110007820472',
    'out_order_no'        => 'P20150806125346',
    'out_return_no'       => 'R20190516001',
    'return_account_type' => 'MERCHANT_ID',
    'return_account'      => '86693852',
    'return_amount'       => '888',
    'description'         => '用户退款',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/secapi/pay/profitsharingreturn')->post([
  'security' => true,
  'xml' => [
    'mch_id'              => '1900000100',
    'sub_mch_id'          => '1900000109',
    'appid'               => 'wx8888888888888888',
    'sub_appid'           => 'wx8888888888888888',
    'sign_type'           => 'HMAC-SHA256',
    'order_id'            => '3008450740201411110007820472',
    'out_order_no'        => 'P20150806125346',
    'out_return_no'       => 'R20190516001',
    'return_account_type' => 'MERCHANT_ID',
    'return_account'      => '86693852',
    'return_amount'       => '888',
    'description'         => '用户退款',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/secapi/pay/profitsharingreturn']->post([
  'security' => true,
  'xml' => [
    'mch_id'              => '1900000100',
    'sub_mch_id'          => '1900000109',
    'appid'               => 'wx8888888888888888',
    'sub_appid'           => 'wx8888888888888888',
    'sign_type'           => 'HMAC-SHA256',
    'order_id'            => '3008450740201411110007820472',
    'out_order_no'        => 'P20150806125346',
    'out_return_no'       => 'R20190516001',
    'return_account_type' => 'MERCHANT_ID',
    'return_account'      => '86693852',
    'return_amount'       => '888',
    'description'         => '用户退款',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
appidstring公众账号ID
mch_idstring商户号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
sub_mch_idstring子商户号
sub_appidstring子商户公众账号ID
sign_typestring签名类型
HMAC-SHA256 枚举值
order_idstring微信分账单号
out_order_nostring商户分账单号
out_return_nostring商户回退单号
return_nostring微信回退单号
return_account_typestring回退方类型
MERCHANT_ID 枚举值
return_accountstring回退方账号
return_amountinteger回退金额
descriptionstring回退描述
resultstring回退结果
SUCCESS | PROCESSING | FAILED 枚举值之一
fail_reasonstring失败原因
ACCOUNT_ABNORMAL | TIME_OUT_CLOSED | PAYER_ACCOUNT_ABNORMAL | INVALID_REQUEST 枚举值之一
finish_timestring完成时间

参阅 官方文档 官方文档

Published on the GitHub by TheNorthMemory