Skip to content

添加分账接收方

服务商代子商户发起添加分账接收方请求,后续可通过发起分账请求将结算后的钱分到该分账接收方。

请求参数类型描述
xmlobject声明请求的XML数据结构
mch_idstring商户号
sub_mch_idstring子商户号
appidstring公众账号ID
sub_appidstring子商户公众账号ID
sign_typestring签名类型
HMAC-SHA256 枚举值
receiverstring分账接收方JSON格式字符串
typestring分账接收方类型
MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一
accountstring分账接收方账号
amountnumber分账金额
descriptionstring分账描述
namestring分账个人接收方姓名
php
$instance->v2->pay->profitsharingaddreceiver->postAsync([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => '{"type": "MERCHANT_ID","account": "190001001","name": "示例商户全称","relation_type": "STORE_OWNER"}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/pay/profitsharingaddreceiver')->postAsync([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => '{"type": "MERCHANT_ID","account": "190001001","name": "示例商户全称","relation_type": "STORE_OWNER"}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/pay/profitsharingaddreceiver']->postAsync([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => '{"type": "MERCHANT_ID","account": "190001001","name": "示例商户全称","relation_type": "STORE_OWNER"}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->pay->profitsharingaddreceiver->post([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => '{"type": "MERCHANT_ID","account": "190001001","name": "示例商户全称","relation_type": "STORE_OWNER"}',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/pay/profitsharingaddreceiver')->post([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => '{"type": "MERCHANT_ID","account": "190001001","name": "示例商户全称","relation_type": "STORE_OWNER"}',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/pay/profitsharingaddreceiver']->post([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => '{"type": "MERCHANT_ID","account": "190001001","name": "示例商户全称","relation_type": "STORE_OWNER"}',
  ],
]);
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错误代码描述
receiverstring分账接收方
typestring分账接收方类型
MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一
accountstring分账接收方账号

参阅 官方文档 官方文档

Published on the GitHub by TheNorthMemory