发起转账并完成自动收款授权
商家转账用户确认模式下,用户申请收款时,商户可通过此接口申请创建转账单。若传入自动收款授权信息,在用户确认收款的过程中会同时引导用户确认自动收款授权。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
appid | string | 商户AppID |
out_bill_no | string | 商户单号 |
openid | string | 收款用户OpenID |
user_name | string | 收款用户姓名 |
transfer_amount | number | 转账金额 |
transfer_remark | string | 转账备注 |
notify_url | string | 通知地址 |
user_recv_perception | string | 用户收款感知 |
transfer_scene_id | string | 转账场景ID1000 | 1002 | 1004 | 1005 | 1009 | 1010 | 1011 | 1013 枚举值之一 |
transfer_scene_report_infos | object[] | 转账场景报备信息 |
info_type | string | 信息类型 |
info_content | string | 信息内容 |
authorization_info | object | 自动收款授权信息 |
user_display_name | string | 用户展示名称 |
out_authorization_no | string | 商户侧授权单号 |
authorization_notify_url | string | 自动收款授权结果通知地址 |
sponsor_mchid | string | 出资商户号 |
headers | object | 声明请求的头参数 |
Wechatpay-Serial | string | 微信支付公钥ID/平台证书序列号 |
php
$instance->v3->fundApp->mchTransfer->transferBills->preTransferWithAuthorization->postAsync([
'json' => [
'appid' => 'wxf636efh567hg4356',
'out_bill_no' => 'plfk2020042013',
'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_id' => '1000',
'transfer_scene_report_infos' => [[
'info_type' => '活动名称',
'info_content' => '注册会员有礼',
],],
'authorization_info' => [
'user_display_name' => 'wx_123456',
'out_authorization_no' => 'plfk2020042013',
'authorization_notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
],
'sponsor_mchid' => '1900001109',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
php
$instance->chain('v3/fund-app/mch-transfer/transfer-bills/pre-transfer-with-authorization')->postAsync([
'json' => [
'appid' => 'wxf636efh567hg4356',
'out_bill_no' => 'plfk2020042013',
'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_id' => '1000',
'transfer_scene_report_infos' => [[
'info_type' => '活动名称',
'info_content' => '注册会员有礼',
],],
'authorization_info' => [
'user_display_name' => 'wx_123456',
'out_authorization_no' => 'plfk2020042013',
'authorization_notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
],
'sponsor_mchid' => '1900001109',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
php
$instance['v3/fund-app/mch-transfer/transfer-bills/pre-transfer-with-authorization']->postAsync([
'json' => [
'appid' => 'wxf636efh567hg4356',
'out_bill_no' => 'plfk2020042013',
'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_id' => '1000',
'transfer_scene_report_infos' => [[
'info_type' => '活动名称',
'info_content' => '注册会员有礼',
],],
'authorization_info' => [
'user_display_name' => 'wx_123456',
'out_authorization_no' => 'plfk2020042013',
'authorization_notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
],
'sponsor_mchid' => '1900001109',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
php
$response = $instance->v3->fundApp->mchTransfer->transferBills->preTransferWithAuthorization->post([
'json' => [
'appid' => 'wxf636efh567hg4356',
'out_bill_no' => 'plfk2020042013',
'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_id' => '1000',
'transfer_scene_report_infos' => [[
'info_type' => '活动名称',
'info_content' => '注册会员有礼',
],],
'authorization_info' => [
'user_display_name' => 'wx_123456',
'out_authorization_no' => 'plfk2020042013',
'authorization_notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
],
'sponsor_mchid' => '1900001109',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
php
$response = $instance->chain('v3/fund-app/mch-transfer/transfer-bills/pre-transfer-with-authorization')->post([
'json' => [
'appid' => 'wxf636efh567hg4356',
'out_bill_no' => 'plfk2020042013',
'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_id' => '1000',
'transfer_scene_report_infos' => [[
'info_type' => '活动名称',
'info_content' => '注册会员有礼',
],],
'authorization_info' => [
'user_display_name' => 'wx_123456',
'out_authorization_no' => 'plfk2020042013',
'authorization_notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
],
'sponsor_mchid' => '1900001109',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
php
$response = $instance['v3/fund-app/mch-transfer/transfer-bills/pre-transfer-with-authorization']->post([
'json' => [
'appid' => 'wxf636efh567hg4356',
'out_bill_no' => 'plfk2020042013',
'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_id' => '1000',
'transfer_scene_report_infos' => [[
'info_type' => '活动名称',
'info_content' => '注册会员有礼',
],],
'authorization_info' => [
'user_display_name' => 'wx_123456',
'out_authorization_no' => 'plfk2020042013',
'authorization_notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
],
'sponsor_mchid' => '1900001109',
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
转账场景ID(transfer_scene_id
) 及 转账场景报备信息(transfer_scene_report_infos
) 有如下固定搭配组合要求:
php
'transfer_scene_id' => '1000', // 现金营销
'transfer_scene_report_infos' => [ // 固定传两组
[
'info_type' => '活动名称', // 固定值
'info_content' => '新会员有礼', // 示例值
],
[
'info_type' => '奖励说明', // 固定值
'info_content' => '抽奖一等奖', // 示例值
],
],
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
php
'transfer_scene_id' => '1002', // 行政补贴
'transfer_scene_report_infos' => [ // 固定传一组
[
'info_type' => '补贴类型', // 固定值
'info_content' => '购车补贴', // 示例值
],
],
1
2
3
4
5
6
7
2
3
4
5
6
7
php
'transfer_scene_id' => '1004', // 保险理赔
'transfer_scene_report_infos' => [ // 固定传三组
[
'info_type' => '保险产品备案编号', // 固定值
'info_content' => '01212121212', // 示例值
],
[
'info_type' => '保险名称', // 固定值
'info_content' => '意外险', // 示例值
],
[
'info_type' => '保险操作单号', // 固定值
'info_content' => '12121245442', // 示例值
],
],
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
php
'transfer_scene_id' => '1005', // 佣金报酬
'transfer_scene_report_infos' => [ // 固定传两组
[
'info_type' => '岗位类型', // 固定值
'info_content' => '外卖员', // 示例值
],
[
'info_type' => '报酬说明', // 固定值
'info_content' => '7月份配送费', // 示例值
],
],
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
php
'transfer_scene_id' => '1009', // 采购货款
'transfer_scene_report_infos' => [ // 固定传一组
[
'info_type' => '采购商品名称', // 固定值
'info_content' => '戴尔笔记本电脑', // 示例值
],
],
1
2
3
4
5
6
7
2
3
4
5
6
7
php
'transfer_scene_id' => '1010', // 二手回收
'transfer_scene_report_infos' => [ // 固定传一组
[
'info_type' => '回收商品名称', // 固定值
'info_content' => '塑料瓶', // 示例值
],
],
1
2
3
4
5
6
7
2
3
4
5
6
7
php
'transfer_scene_id' => '1011', // 企业赔付
'transfer_scene_report_infos' => [ // 固定传一组
[
'info_type' => '赔付原因', // 固定值
'info_content' => '商品质量问题退款', // 示例值
],
],
1
2
3
4
5
6
7
2
3
4
5
6
7
php
'transfer_scene_id' => '1013', // 公益补助
'transfer_scene_report_infos' => [ // 固定传两组
[
'info_type' => '公益活动名称', // 固定值
'info_content' => '在民政部的备案名称', // 示例值
],
[
'info_type' => '公益活动备案编号', // 固定值
'info_content' => '在民政部的备案编号', // 示例值
],
],
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
返回字典 | 类型 | 描述 |
---|---|---|
out_bill_no | string | 商户单号 |
transfer_bill_no | string | 微信转账单号 |
create_time | string | 单据创建时间 |
state | string | 单据状态ACCEPTED | PROCESSING | WAIT_USER_CONFIRM | TRANSFERING | SUCCESS | CANCELING 枚举值之一 |
package_info | string | 跳转领取页面的package信息 |
user_display_name | string | 用户展示名称 |
out_authorization_no | string | 商户侧授权单号 |
参阅 官方文档