Skip to content

向微信用户个人付款

目前支持向指定微信用户的openid付款。

请求参数类型描述
securitytrue声明加载商户API证书
xmlobject声明请求的XML数据结构
mch_appidstring商户账号appid
mchidstring商户号
device_infostring设备号
partner_trade_nostring商户订单号
openidstring用户openid
check_namestring校验用户姓名选项
re_user_namestring收款用户姓名
amountinteger金额
descstring企业付款备注
spbill_create_ipstringIp地址
scenestring付款场景,BRAND_REDPACKET:品牌红包,其他值或不传则默认为普通付款到零钱
brand_idinteger品牌ID,品牌在微信支付的唯一标识。仅在付款场景为品牌红包时必填。
finder_template_idstring消息模板ID,品牌在微信支付的唯一标识。仅在付款场景为品牌红包时必填。
php
$instance->v2->mmpaymkttransfers->promotion->transfers->postAsync([
  'security' => true,
  'xml' => [
    'mch_appid'          => 'wx8888888888888888',
    'mchid'              => '1900000109',
    'device_info'        => '013467007045764',
    'partner_trade_no'   => '10000098201411111234567890',
    'openid'             => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'         => 'FORCE_CHECK',
    're_user_name'       => '王小王',
    'amount'             => '10099',
    'desc'               => '理赔',
    'spbill_create_ip'   => '192.168.0.1',
    'scene'              => 'BRAND_REDPACKET',
    'brand_id'           => '1234',
    'finder_template_id' => '1243100000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/mmpaymkttransfers/promotion/transfers')->postAsync([
  'security' => true,
  'xml' => [
    'mch_appid'          => 'wx8888888888888888',
    'mchid'              => '1900000109',
    'device_info'        => '013467007045764',
    'partner_trade_no'   => '10000098201411111234567890',
    'openid'             => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'         => 'FORCE_CHECK',
    're_user_name'       => '王小王',
    'amount'             => '10099',
    'desc'               => '理赔',
    'spbill_create_ip'   => '192.168.0.1',
    'scene'              => 'BRAND_REDPACKET',
    'brand_id'           => '1234',
    'finder_template_id' => '1243100000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/mmpaymkttransfers/promotion/transfers']->postAsync([
  'security' => true,
  'xml' => [
    'mch_appid'          => 'wx8888888888888888',
    'mchid'              => '1900000109',
    'device_info'        => '013467007045764',
    'partner_trade_no'   => '10000098201411111234567890',
    'openid'             => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'         => 'FORCE_CHECK',
    're_user_name'       => '王小王',
    'amount'             => '10099',
    'desc'               => '理赔',
    'spbill_create_ip'   => '192.168.0.1',
    'scene'              => 'BRAND_REDPACKET',
    'brand_id'           => '1234',
    'finder_template_id' => '1243100000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->mmpaymkttransfers->promotion->transfers->post([
  'security' => true,
  'xml' => [
    'mch_appid'          => 'wx8888888888888888',
    'mchid'              => '1900000109',
    'device_info'        => '013467007045764',
    'partner_trade_no'   => '10000098201411111234567890',
    'openid'             => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'         => 'FORCE_CHECK',
    're_user_name'       => '王小王',
    'amount'             => '10099',
    'desc'               => '理赔',
    'spbill_create_ip'   => '192.168.0.1',
    'scene'              => 'BRAND_REDPACKET',
    'brand_id'           => '1234',
    'finder_template_id' => '1243100000000000',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/mmpaymkttransfers/promotion/transfers')->post([
  'security' => true,
  'xml' => [
    'mch_appid'          => 'wx8888888888888888',
    'mchid'              => '1900000109',
    'device_info'        => '013467007045764',
    'partner_trade_no'   => '10000098201411111234567890',
    'openid'             => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'         => 'FORCE_CHECK',
    're_user_name'       => '王小王',
    'amount'             => '10099',
    'desc'               => '理赔',
    'spbill_create_ip'   => '192.168.0.1',
    'scene'              => 'BRAND_REDPACKET',
    'brand_id'           => '1234',
    'finder_template_id' => '1243100000000000',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/mmpaymkttransfers/promotion/transfers']->post([
  'security' => true,
  'xml' => [
    'mch_appid'          => 'wx8888888888888888',
    'mchid'              => '1900000109',
    'device_info'        => '013467007045764',
    'partner_trade_no'   => '10000098201411111234567890',
    'openid'             => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'         => 'FORCE_CHECK',
    're_user_name'       => '王小王',
    'amount'             => '10099',
    'desc'               => '理赔',
    'spbill_create_ip'   => '192.168.0.1',
    'scene'              => 'BRAND_REDPACKET',
    'brand_id'           => '1234',
    'finder_template_id' => '1243100000000000',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
mch_appidstring商户appid
mchidstring商户号
device_infostring设备号
nonce_strstring随机字符串
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
partner_trade_nostring商户订单号
payment_nostring微信付款单号
payment_timestring付款成功时间

参阅 官方文档

Published on the GitHub by TheNorthMemory