Skip to content

品牌商户发放红包

普通直连商户可以通过该接口,向多个用户发放品牌红包,微信支付视任何不同“发起的普通直连商户商户号+商家品牌红包批次单号(out_batch_no)”的请求为一个全新的批次。在未查询到明确的品牌红包批次单处理结果之前,请勿修改商家品牌红包批次单号重新提交!如有发生,普通直连商户应当自行承担因此产生的所有损失和责任。

请求参数类型描述
jsonobject声明请求的JSON数据结构
brand_idnumber品牌ID
brand_appidstring品牌AppID
scenestring品牌红包发放场景
CUSTOM_SEND 枚举值
template_idstring品牌红包模板ID
out_batch_nostring商家品牌红包批次单号
batch_namestring品牌红包批次名称
batch_remarkstring品牌红包批次备注
total_amountnumber总金额
total_numnumber总笔数
detail_listobject[]品牌红包明细列表
out_detail_nostring商家品牌红包明细单号
amountnumber红包金额(单位:分)
openidstring接收红包用户OpenID
user_namestring接收红包用户姓名
remarkstring红包备注
headersobject声明请求的头参数
Wechatpay-Serialstring微信支付公钥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_nostring商家品牌红包批次单号
batch_nostring微信支付品牌红包批次单号
create_timestring品牌红包批次创建时间
batch_statestring批次单状态
WAIT_PAY | ACCEPTED | PROCESSING | FINISHED | CLOSED 枚举值之一

参阅 官方文档

Published on the GitHub by TheNorthMemory