添加分账接收方 
服务商代子商户发起添加分账接收方请求,后续可通过发起分账请求将结算后的钱分到该分账接收方。
| 请求参数 | 类型 | 描述 | 
|---|---|---|
| xml | object | 声明请求的XML数据结构 | 
| mch_id | string | 商户号 | 
| sub_mch_id | string | 子商户号 | 
| appid | string | 公众账号ID | 
| sub_appid | string | 子商户公众账号ID | 
| sign_type | string | 签名类型HMAC-SHA256 枚举值 | 
| receiver | string | 分账接收方JSON格式字符串 | 
| type | string | 分账接收方类型MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一 | 
| account | string | 分账接收方账号 | 
| name | string | 分账个人接收方姓名 | 
| relation_type | string | 与分账方的关系类型SERVICE_PROVIDER | STORE | STAFF | STORE_OWNER | PARTNER | HEADQUARTER | BRAND | DISTRIBUTOR | USER | SUPPLIER | CUSTOM | PLATFORM | OTHERS 枚举值之一 | 
| custom_relation | string | 自定义的分账关系 | 
php
$instance->v2->pay->profitsharingaddreceiver->postAsync([
  'xml' => [
    'mch_id'     => '1900000100',
    'sub_mch_id' => '1900000109',
    'appid'      => 'wx8888888888888888',
    'sub_appid'  => 'wx8888888888888888',
    'sign_type'  => 'HMAC-SHA256',
    'receiver'   => \json_encode([
      'type'            => 'MERCHANT_ID',
      'account'         => '190001001',
      'name'            => '示例商户全称',
      'relation_type'   => 'SERVICE_PROVIDER',
      'custom_relation' => '代理商',
    ]),
  ],
])
->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'   => \json_encode([
      'type'            => 'MERCHANT_ID',
      'account'         => '190001001',
      'name'            => '示例商户全称',
      'relation_type'   => 'SERVICE_PROVIDER',
      'custom_relation' => '代理商',
    ]),
  ],
])
->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'   => \json_encode([
      'type'            => 'MERCHANT_ID',
      'account'         => '190001001',
      'name'            => '示例商户全称',
      'relation_type'   => 'SERVICE_PROVIDER',
      'custom_relation' => '代理商',
    ]),
  ],
])
->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'   => \json_encode([
      'type'            => 'MERCHANT_ID',
      'account'         => '190001001',
      'name'            => '示例商户全称',
      'relation_type'   => 'SERVICE_PROVIDER',
      'custom_relation' => '代理商',
    ]),
  ],
]);
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'   => \json_encode([
      'type'            => 'MERCHANT_ID',
      'account'         => '190001001',
      'name'            => '示例商户全称',
      'relation_type'   => 'SERVICE_PROVIDER',
      'custom_relation' => '代理商',
    ]),
  ],
]);
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'   => \json_encode([
      'type'            => 'MERCHANT_ID',
      'account'         => '190001001',
      'name'            => '示例商户全称',
      'relation_type'   => 'SERVICE_PROVIDER',
      'custom_relation' => '代理商',
    ]),
  ],
]);
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 | 错误代码描述 | 
| receiver | string | 分账接收方 | 
| type | string | 分账接收方类型MERCHANT_ID | PERSONAL_OPENID | PERSONAL_SUB_OPENID 枚举值之一 | 
| account | string | 分账接收方账号 |