Skip to content

发起转账

商家转账用户确认模式下,用户申请收款时,商户可通过此接口申请创建转账单

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring商户AppID
out_bill_nostring商户单号
transfer_scene_idstring转账场景ID
openidstring收款用户OpenID
user_namestring收款用户姓名
transfer_amountnumber转账金额
transfer_remarkstring转账备注
notify_urlstring通知地址
user_recv_perceptionstring用户收款感知
transfer_scene_report_infosobject[]转账场景报备信息
info_typestring信息类型
info_contentstring信息内容
headersobject声明请求的头参数
Wechatpay-Serialstring平台公钥ID/平台公钥证书序列号
php
$instance->v3->fundApp->mchTransfer->transferBills->postAsync([
  'json' => [
    'appid'                       => 'wxf636efh567hg4356',
    'out_bill_no'                 => 'plfk2020042013',
    'transfer_scene_id'           => '1000',
    'openid'                      => 'o-MYE42l80oelYMDE34nYD456Xoy',
    'user_name'                   => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'transfer_amount'             => 400000,
    'transfer_remark'             => '2020年4月报销',
    'notify_url'                  => 'https://www.weixin.qq.com/wxpay/pay.php',
    'user_recv_perception'        => '现金奖励',
    'transfer_scene_report_infos' => [[
      'info_type'    => '活动名称',
      'info_content' => '注册会员有礼',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/fund-app/mch-transfer/transfer-bills')->postAsync([
  'json' => [
    'appid'                       => 'wxf636efh567hg4356',
    'out_bill_no'                 => 'plfk2020042013',
    'transfer_scene_id'           => '1000',
    'openid'                      => 'o-MYE42l80oelYMDE34nYD456Xoy',
    'user_name'                   => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'transfer_amount'             => 400000,
    'transfer_remark'             => '2020年4月报销',
    'notify_url'                  => 'https://www.weixin.qq.com/wxpay/pay.php',
    'user_recv_perception'        => '现金奖励',
    'transfer_scene_report_infos' => [[
      'info_type'    => '活动名称',
      'info_content' => '注册会员有礼',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/fund-app/mch-transfer/transfer-bills']->postAsync([
  'json' => [
    'appid'                       => 'wxf636efh567hg4356',
    'out_bill_no'                 => 'plfk2020042013',
    'transfer_scene_id'           => '1000',
    'openid'                      => 'o-MYE42l80oelYMDE34nYD456Xoy',
    'user_name'                   => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'transfer_amount'             => 400000,
    'transfer_remark'             => '2020年4月报销',
    'notify_url'                  => 'https://www.weixin.qq.com/wxpay/pay.php',
    'user_recv_perception'        => '现金奖励',
    'transfer_scene_report_infos' => [[
      'info_type'    => '活动名称',
      'info_content' => '注册会员有礼',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->fundApp->mchTransfer->transferBills->post([
  'json' => [
    'appid'                       => 'wxf636efh567hg4356',
    'out_bill_no'                 => 'plfk2020042013',
    'transfer_scene_id'           => '1000',
    'openid'                      => 'o-MYE42l80oelYMDE34nYD456Xoy',
    'user_name'                   => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'transfer_amount'             => 400000,
    'transfer_remark'             => '2020年4月报销',
    'notify_url'                  => 'https://www.weixin.qq.com/wxpay/pay.php',
    'user_recv_perception'        => '现金奖励',
    'transfer_scene_report_infos' => [[
      'info_type'    => '活动名称',
      'info_content' => '注册会员有礼',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/fund-app/mch-transfer/transfer-bills')->post([
  'json' => [
    'appid'                       => 'wxf636efh567hg4356',
    'out_bill_no'                 => 'plfk2020042013',
    'transfer_scene_id'           => '1000',
    'openid'                      => 'o-MYE42l80oelYMDE34nYD456Xoy',
    'user_name'                   => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'transfer_amount'             => 400000,
    'transfer_remark'             => '2020年4月报销',
    'notify_url'                  => 'https://www.weixin.qq.com/wxpay/pay.php',
    'user_recv_perception'        => '现金奖励',
    'transfer_scene_report_infos' => [[
      'info_type'    => '活动名称',
      'info_content' => '注册会员有礼',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/fund-app/mch-transfer/transfer-bills']->post([
  'json' => [
    'appid'                       => 'wxf636efh567hg4356',
    'out_bill_no'                 => 'plfk2020042013',
    'transfer_scene_id'           => '1000',
    'openid'                      => 'o-MYE42l80oelYMDE34nYD456Xoy',
    'user_name'                   => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'transfer_amount'             => 400000,
    'transfer_remark'             => '2020年4月报销',
    'notify_url'                  => 'https://www.weixin.qq.com/wxpay/pay.php',
    'user_recv_perception'        => '现金奖励',
    'transfer_scene_report_infos' => [[
      'info_type'    => '活动名称',
      'info_content' => '注册会员有礼',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
out_bill_nostring商户单号
transfer_bill_nostring微信转账单号
create_timestring单据创建时间
statestring单据状态
fail_reasonstring失败原因
package_infostring跳转领取页面的package信息

参阅 官方文档

Published on the GitHub by TheNorthMemory