发起转账
商户可通过此接口申请创建商家转账订单。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
sub_mchid | string | 二级商户号 |
appid | string | 服务商AppID |
out_bill_no | string | 商户单号 |
transfer_scene_id | string | 转账场景ID |
openid | string | 收款用户OpenID |
user_name | string | 收款用户姓名 |
transfer_amount | number | 转账金额 |
transfer_remark | string | 转账备注 |
notify_url | string | 商户回调地址 |
headers | object | 声明请求的头参数 |
Wechatpay-Serial | string | 平台公钥ID/平台公钥证书序列号 |
php
$instance->v3->ecommerce->mchTransfer->transferBills->postAsync([
'json' => [
'sub_mchid' => '1900001109',
'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',
],
'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/ecommerce/mch-transfer/transfer-bills')->postAsync([
'json' => [
'sub_mchid' => '1900001109',
'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',
],
'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/ecommerce/mch-transfer/transfer-bills']->postAsync([
'json' => [
'sub_mchid' => '1900001109',
'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',
],
'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->ecommerce->mchTransfer->transferBills->post([
'json' => [
'sub_mchid' => '1900001109',
'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',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ecommerce/mch-transfer/transfer-bills')->post([
'json' => [
'sub_mchid' => '1900001109',
'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',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ecommerce/mch-transfer/transfer-bills']->post([
'json' => [
'sub_mchid' => '1900001109',
'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',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
sub_mchid | string | 二级商户号 |
out_bill_no | string | 商户单号 |
transfer_bill_no | string | 微信转账单号 |
create_time | string | 单据创建时间 |
state | string | 单据状态 |
fail_reason | string | 失败原因 |
package_info | string | 跳转领取页面的package信息 |
参阅 官方文档