品牌商户发放红包
普通直连商户可以通过该接口,向多个用户发放品牌红包,微信支付视任何不同“发起的普通直连商户商户号+商家品牌红包批次单号(out_batch_no)”的请求为一个全新的批次。在未查询到明确的品牌红包批次单处理结果之前,请勿修改商家品牌红包批次单号重新提交!如有发生,普通直连商户应当自行承担因此产生的所有损失和责任。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
brand_id | number | 品牌ID |
brand_appid | string | 品牌AppID |
scene | string | 品牌红包发放场景CUSTOM_SEND 枚举值 |
template_id | string | 品牌红包模板ID |
out_batch_no | string | 商家品牌红包批次单号 |
batch_name | string | 品牌红包批次名称 |
batch_remark | string | 品牌红包批次备注 |
total_amount | number | 总金额 |
total_num | number | 总笔数 |
detail_list | object[] | 品牌红包明细列表 |
out_detail_no | string | 商家品牌红包明细单号 |
amount | number | 红包金额(单位:分) |
openid | string | 接收红包用户OpenID |
user_name | string | 接收红包用户姓名 |
remark | string | 红包备注 |
headers | object | 声明请求的头参数 |
Wechatpay-Serial | string | 微信支付公钥ID/平台证书序列号 |
php
$instance->v3->fundApp->brandRedpacket->brandMerchantBatches->postAsync([
'json' => [
'brand_id' => 1234,
'brand_appid' => 'wxf636efh567hg4356',
'scene' => 'CUSTOM_SEND',
'template_id' => '123400001',
'out_batch_no' => 'plfk2020042013',
'batch_name' => '双十一营销用品牌红包',
'batch_remark' => '双十一营销用品牌红包',
'total_amount' => 10000,
'total_num' => 10,
'detail_list' => [[
'out_detail_no' => 'x23zy545Bd5436',
'amount' => 100,
'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
'remark' => '来自XX的红包',
],],
],
'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/brand-redpacket/brand-merchant-batches')->postAsync([
'json' => [
'brand_id' => 1234,
'brand_appid' => 'wxf636efh567hg4356',
'scene' => 'CUSTOM_SEND',
'template_id' => '123400001',
'out_batch_no' => 'plfk2020042013',
'batch_name' => '双十一营销用品牌红包',
'batch_remark' => '双十一营销用品牌红包',
'total_amount' => 10000,
'total_num' => 10,
'detail_list' => [[
'out_detail_no' => 'x23zy545Bd5436',
'amount' => 100,
'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
'remark' => '来自XX的红包',
],],
],
'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/brand-redpacket/brand-merchant-batches']->postAsync([
'json' => [
'brand_id' => 1234,
'brand_appid' => 'wxf636efh567hg4356',
'scene' => 'CUSTOM_SEND',
'template_id' => '123400001',
'out_batch_no' => 'plfk2020042013',
'batch_name' => '双十一营销用品牌红包',
'batch_remark' => '双十一营销用品牌红包',
'total_amount' => 10000,
'total_num' => 10,
'detail_list' => [[
'out_detail_no' => 'x23zy545Bd5436',
'amount' => 100,
'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
'remark' => '来自XX的红包',
],],
],
'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->brandRedpacket->brandMerchantBatches->post([
'json' => [
'brand_id' => 1234,
'brand_appid' => 'wxf636efh567hg4356',
'scene' => 'CUSTOM_SEND',
'template_id' => '123400001',
'out_batch_no' => 'plfk2020042013',
'batch_name' => '双十一营销用品牌红包',
'batch_remark' => '双十一营销用品牌红包',
'total_amount' => 10000,
'total_num' => 10,
'detail_list' => [[
'out_detail_no' => 'x23zy545Bd5436',
'amount' => 100,
'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
'remark' => '来自XX的红包',
],],
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/fund-app/brand-redpacket/brand-merchant-batches')->post([
'json' => [
'brand_id' => 1234,
'brand_appid' => 'wxf636efh567hg4356',
'scene' => 'CUSTOM_SEND',
'template_id' => '123400001',
'out_batch_no' => 'plfk2020042013',
'batch_name' => '双十一营销用品牌红包',
'batch_remark' => '双十一营销用品牌红包',
'total_amount' => 10000,
'total_num' => 10,
'detail_list' => [[
'out_detail_no' => 'x23zy545Bd5436',
'amount' => 100,
'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
'remark' => '来自XX的红包',
],],
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/fund-app/brand-redpacket/brand-merchant-batches']->post([
'json' => [
'brand_id' => 1234,
'brand_appid' => 'wxf636efh567hg4356',
'scene' => 'CUSTOM_SEND',
'template_id' => '123400001',
'out_batch_no' => 'plfk2020042013',
'batch_name' => '双十一营销用品牌红包',
'batch_remark' => '双十一营销用品牌红包',
'total_amount' => 10000,
'total_num' => 10,
'detail_list' => [[
'out_detail_no' => 'x23zy545Bd5436',
'amount' => 100,
'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
'remark' => '来自XX的红包',
],],
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
out_batch_no | string | 商家品牌红包批次单号 |
batch_no | string | 微信支付品牌红包批次单号 |
create_time | string | 品牌红包批次创建时间 |
batch_state | string | 批次单状态WAIT_PAY | ACCEPTED | PROCESSING | FINISHED | CLOSED 枚举值之一 |
参阅 官方文档