Skip to content

创建商家券

商户可以通过该接口创建商家券。

请求参数类型描述
jsonobject声明请求的JSON数据结构
stock_namestring商家券批次名称
belong_merchantstring批次归属商户号
commentstring批次备注
goods_namestring适用商品范围
stock_typestring批次类型
coupon_use_ruleobject核销规则
coupon_available_timeobject券可核销时间
available_begin_timestring开始时间
available_end_timestring结束时间
available_day_after_receiveinteger生效后N天内有效
available_weekobject固定周期有效时间段
week_daystring[]可用星期数
available_day_timeobject[]当天可用时间段
begin_timeinteger当天可用开始时间
end_timeinteger当天可用结束时间
irregulary_avaliable_timeobject[]无规律的有效时间段
begin_timestring开始时间
end_timestring结束时间
wait_days_after_receiveinteger领取后N天开始生效
fixed_normal_couponobject固定面额满减券使用规则
discount_amountinteger优惠金额
transaction_minimuminteger消费门槛
discount_couponobject折扣券使用规则
discount_percentinteger折扣比例
transaction_minimuminteger消费门槛
exchange_couponobject换购券使用规则
exchange_priceinteger单品换购价
transaction_minimuminteger消费门槛
use_methodstring核销方式
mini_programs_appidstring小程序appid
mini_programs_pathstring小程序path
stock_send_ruleobject发放规则
max_amountnumber批次总预算
max_couponsinteger批次最大发放个数
max_coupons_per_userinteger用户最大可领个数
max_amount_by_daynumber单天发放上限金额
max_coupons_by_dayinteger单天发放上限个数
natural_person_limitboolean是否开启自然人限制
prevent_api_abuseboolean可疑账号拦截
transferableboolean是否允许转赠
shareableboolean是否允许分享链接
out_request_nostring商户请求单号
custom_entranceobject自定义入口
mini_programs_infoobject小程序入口
mini_programs_appidstring商家小程序appid
mini_programs_pathstring商家小程序path
entrance_wordsstring入口文案
guiding_wordsstring引导文案
appidstring商户公众号appid
hall_idstring营销馆id
store_idstring可用门店id
code_display_modestringcode展示模式
display_pattern_infoobject样式信息
descriptionstring使用须知
merchant_logo_urlstring商户logo
merchant_namestring商户名称
background_colorstring背景颜色
coupon_image_urlstring券详情图片
finder_infoobject视频号相关信息
finder_idstring视频号ID
finder_video_idstring视频号视频ID
finder_video_cover_image_urlstring视频号封面图
coupon_code_modestring券code模式
notify_configobject事件通知配置
notify_appidstring事件通知appid
subsidyboolean是否允许营销补贴
php
$instance->v3->marketing->busifavor->stocks->postAsync([
  'json' => [
    'stock_name' => '8月1日活动券',
    'belong_merchant' => '10000022',
    'comment' => '活动使用',
    'goods_name' => 'xxx商品使用',
    'stock_type' => 'NORMAL',
    'coupon_use_rule' => [
      'coupon_available_time' => [
        'available_begin_time' => '2015-05-20T13:29:35+08:00',
        'available_end_time' => '2015-05-20T13:29:35+08:00',
        'available_day_after_receive' => 3,
        'available_week' => [
          'week_day' => [1, 2],
          'available_day_time' => [[
            'begin_time' => 3600,
            'end_time' => 86399,
          ],],
        ],
        'irregulary_avaliable_time' => [[
          'begin_time' => '2015-05-20T13:29:35+08:00',
          'end_time' => '2015-05-20T13:29:35+08:00',
        ],],
        'wait_days_after_receive' => 7,
      ],
      'fixed_normal_coupon' => [
        'discount_amount' => 5,
        'transaction_minimum' => 100,
      ],
      'discount_coupon' => [
        'discount_percent' => 88,
        'transaction_minimum' => 100,
      ],
      'exchange_coupon' => [
        'exchange_price' => 100,
        'transaction_minimum' => 100,
      ],
      'use_method' => 'OFF_LINE',
      'mini_programs_appid' => 'wx23232232323',
      'mini_programs_path' => '/path/index/index',
    ],
    'stock_send_rule' => [
      'max_amount' => 100000,
      'max_coupons' => 100,
      'max_coupons_per_user' => 5,
      'max_amount_by_day' => 1000,
      'max_coupons_by_day' => 100,
      'natural_person_limit' => true,
      'prevent_api_abuse' => true,
      'transferable' => true,
      'shareable' => true,
    ],
    'out_request_no' => '100002322019090134234sfdf',
    'custom_entrance' => [
      'mini_programs_info' => [
        'mini_programs_appid' => 'wx234545656765876',
        'mini_programs_path' => '/path/index/index',
        'entrance_words' => '欢迎选购',
        'guiding_words' => '获取更多优惠',
      ],
      'appid' => 'wx324345hgfhfghfg',
      'hall_id' => '233455656',
      'store_id' => '233554655',
      'code_display_mode' => 'BARCODE',
    ],
    'display_pattern_info' => [
      'description' => 'xxx门店可用',
      'merchant_logo_url' => 'https://qpic.cn/xxx',
      'merchant_name' => '微信支付',
      'background_color' => 'Color020',
      'coupon_image_url' => 'https://qpic.cn/xxx',
      'finder_info' => [
        'finder_id' => 'sph6Rngt2T4RlUf',
        'finder_video_id' => 'sph6Rngt2T4RlUf',
        'finder_video_cover_image_url' => 'https://wxpaylogo.qpic.cn/xxx',
      ],
    ],
    'coupon_code_mode' => 'WECHATPAY_MODE',
    'notify_config' => [
      'notify_appid' => 'wx23232232323',
    ],
    'subsidy' => true,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/marketing/busifavor/stocks')->postAsync([
  'json' => [
    'stock_name' => '8月1日活动券',
    'belong_merchant' => '10000022',
    'comment' => '活动使用',
    'goods_name' => 'xxx商品使用',
    'stock_type' => 'NORMAL',
    'coupon_use_rule' => [
      'coupon_available_time' => [
        'available_begin_time' => '2015-05-20T13:29:35+08:00',
        'available_end_time' => '2015-05-20T13:29:35+08:00',
        'available_day_after_receive' => 3,
        'available_week' => [
          'week_day' => [1, 2],
          'available_day_time' => [[
            'begin_time' => 3600,
            'end_time' => 86399,
          ],],
        ],
        'irregulary_avaliable_time' => [[
          'begin_time' => '2015-05-20T13:29:35+08:00',
          'end_time' => '2015-05-20T13:29:35+08:00',
        ],],
        'wait_days_after_receive' => 7,
      ],
      'fixed_normal_coupon' => [
        'discount_amount' => 5,
        'transaction_minimum' => 100,
      ],
      'discount_coupon' => [
        'discount_percent' => 88,
        'transaction_minimum' => 100,
      ],
      'exchange_coupon' => [
        'exchange_price' => 100,
        'transaction_minimum' => 100,
      ],
      'use_method' => 'OFF_LINE',
      'mini_programs_appid' => 'wx23232232323',
      'mini_programs_path' => '/path/index/index',
    ],
    'stock_send_rule' => [
      'max_amount' => 100000,
      'max_coupons' => 100,
      'max_coupons_per_user' => 5,
      'max_amount_by_day' => 1000,
      'max_coupons_by_day' => 100,
      'natural_person_limit' => true,
      'prevent_api_abuse' => true,
      'transferable' => true,
      'shareable' => true,
    ],
    'out_request_no' => '100002322019090134234sfdf',
    'custom_entrance' => [
      'mini_programs_info' => [
        'mini_programs_appid' => 'wx234545656765876',
        'mini_programs_path' => '/path/index/index',
        'entrance_words' => '欢迎选购',
        'guiding_words' => '获取更多优惠',
      ],
      'appid' => 'wx324345hgfhfghfg',
      'hall_id' => '233455656',
      'store_id' => '233554655',
      'code_display_mode' => 'BARCODE',
    ],
    'display_pattern_info' => [
      'description' => 'xxx门店可用',
      'merchant_logo_url' => 'https://qpic.cn/xxx',
      'merchant_name' => '微信支付',
      'background_color' => 'Color020',
      'coupon_image_url' => 'https://qpic.cn/xxx',
      'finder_info' => [
        'finder_id' => 'sph6Rngt2T4RlUf',
        'finder_video_id' => 'sph6Rngt2T4RlUf',
        'finder_video_cover_image_url' => 'https://wxpaylogo.qpic.cn/xxx',
      ],
    ],
    'coupon_code_mode' => 'WECHATPAY_MODE',
    'notify_config' => [
      'notify_appid' => 'wx23232232323',
    ],
    'subsidy' => true,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/marketing/busifavor/stocks']->postAsync([
  'json' => [
    'stock_name' => '8月1日活动券',
    'belong_merchant' => '10000022',
    'comment' => '活动使用',
    'goods_name' => 'xxx商品使用',
    'stock_type' => 'NORMAL',
    'coupon_use_rule' => [
      'coupon_available_time' => [
        'available_begin_time' => '2015-05-20T13:29:35+08:00',
        'available_end_time' => '2015-05-20T13:29:35+08:00',
        'available_day_after_receive' => 3,
        'available_week' => [
          'week_day' => [1, 2],
          'available_day_time' => [[
            'begin_time' => 3600,
            'end_time' => 86399,
          ],],
        ],
        'irregulary_avaliable_time' => [[
          'begin_time' => '2015-05-20T13:29:35+08:00',
          'end_time' => '2015-05-20T13:29:35+08:00',
        ],],
        'wait_days_after_receive' => 7,
      ],
      'fixed_normal_coupon' => [
        'discount_amount' => 5,
        'transaction_minimum' => 100,
      ],
      'discount_coupon' => [
        'discount_percent' => 88,
        'transaction_minimum' => 100,
      ],
      'exchange_coupon' => [
        'exchange_price' => 100,
        'transaction_minimum' => 100,
      ],
      'use_method' => 'OFF_LINE',
      'mini_programs_appid' => 'wx23232232323',
      'mini_programs_path' => '/path/index/index',
    ],
    'stock_send_rule' => [
      'max_amount' => 100000,
      'max_coupons' => 100,
      'max_coupons_per_user' => 5,
      'max_amount_by_day' => 1000,
      'max_coupons_by_day' => 100,
      'natural_person_limit' => true,
      'prevent_api_abuse' => true,
      'transferable' => true,
      'shareable' => true,
    ],
    'out_request_no' => '100002322019090134234sfdf',
    'custom_entrance' => [
      'mini_programs_info' => [
        'mini_programs_appid' => 'wx234545656765876',
        'mini_programs_path' => '/path/index/index',
        'entrance_words' => '欢迎选购',
        'guiding_words' => '获取更多优惠',
      ],
      'appid' => 'wx324345hgfhfghfg',
      'hall_id' => '233455656',
      'store_id' => '233554655',
      'code_display_mode' => 'BARCODE',
    ],
    'display_pattern_info' => [
      'description' => 'xxx门店可用',
      'merchant_logo_url' => 'https://qpic.cn/xxx',
      'merchant_name' => '微信支付',
      'background_color' => 'Color020',
      'coupon_image_url' => 'https://qpic.cn/xxx',
      'finder_info' => [
        'finder_id' => 'sph6Rngt2T4RlUf',
        'finder_video_id' => 'sph6Rngt2T4RlUf',
        'finder_video_cover_image_url' => 'https://wxpaylogo.qpic.cn/xxx',
      ],
    ],
    'coupon_code_mode' => 'WECHATPAY_MODE',
    'notify_config' => [
      'notify_appid' => 'wx23232232323',
    ],
    'subsidy' => true,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->marketing->busifavor->stocks->post([
  'json' => [
    'stock_name' => '8月1日活动券',
    'belong_merchant' => '10000022',
    'comment' => '活动使用',
    'goods_name' => 'xxx商品使用',
    'stock_type' => 'NORMAL',
    'coupon_use_rule' => [
      'coupon_available_time' => [
        'available_begin_time' => '2015-05-20T13:29:35+08:00',
        'available_end_time' => '2015-05-20T13:29:35+08:00',
        'available_day_after_receive' => 3,
        'available_week' => [
          'week_day' => [1, 2],
          'available_day_time' => [[
            'begin_time' => 3600,
            'end_time' => 86399,
          ],],
        ],
        'irregulary_avaliable_time' => [[
          'begin_time' => '2015-05-20T13:29:35+08:00',
          'end_time' => '2015-05-20T13:29:35+08:00',
        ],],
        'wait_days_after_receive' => 7,
      ],
      'fixed_normal_coupon' => [
        'discount_amount' => 5,
        'transaction_minimum' => 100,
      ],
      'discount_coupon' => [
        'discount_percent' => 88,
        'transaction_minimum' => 100,
      ],
      'exchange_coupon' => [
        'exchange_price' => 100,
        'transaction_minimum' => 100,
      ],
      'use_method' => 'OFF_LINE',
      'mini_programs_appid' => 'wx23232232323',
      'mini_programs_path' => '/path/index/index',
    ],
    'stock_send_rule' => [
      'max_amount' => 100000,
      'max_coupons' => 100,
      'max_coupons_per_user' => 5,
      'max_amount_by_day' => 1000,
      'max_coupons_by_day' => 100,
      'natural_person_limit' => true,
      'prevent_api_abuse' => true,
      'transferable' => true,
      'shareable' => true,
    ],
    'out_request_no' => '100002322019090134234sfdf',
    'custom_entrance' => [
      'mini_programs_info' => [
        'mini_programs_appid' => 'wx234545656765876',
        'mini_programs_path' => '/path/index/index',
        'entrance_words' => '欢迎选购',
        'guiding_words' => '获取更多优惠',
      ],
      'appid' => 'wx324345hgfhfghfg',
      'hall_id' => '233455656',
      'store_id' => '233554655',
      'code_display_mode' => 'BARCODE',
    ],
    'display_pattern_info' => [
      'description' => 'xxx门店可用',
      'merchant_logo_url' => 'https://qpic.cn/xxx',
      'merchant_name' => '微信支付',
      'background_color' => 'Color020',
      'coupon_image_url' => 'https://qpic.cn/xxx',
      'finder_info' => [
        'finder_id' => 'sph6Rngt2T4RlUf',
        'finder_video_id' => 'sph6Rngt2T4RlUf',
        'finder_video_cover_image_url' => 'https://wxpaylogo.qpic.cn/xxx',
      ],
    ],
    'coupon_code_mode' => 'WECHATPAY_MODE',
    'notify_config' => [
      'notify_appid' => 'wx23232232323',
    ],
    'subsidy' => true,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/busifavor/stocks')->post([
  'json' => [
    'stock_name' => '8月1日活动券',
    'belong_merchant' => '10000022',
    'comment' => '活动使用',
    'goods_name' => 'xxx商品使用',
    'stock_type' => 'NORMAL',
    'coupon_use_rule' => [
      'coupon_available_time' => [
        'available_begin_time' => '2015-05-20T13:29:35+08:00',
        'available_end_time' => '2015-05-20T13:29:35+08:00',
        'available_day_after_receive' => 3,
        'available_week' => [
          'week_day' => [1, 2],
          'available_day_time' => [[
            'begin_time' => 3600,
            'end_time' => 86399,
          ],],
        ],
        'irregulary_avaliable_time' => [[
          'begin_time' => '2015-05-20T13:29:35+08:00',
          'end_time' => '2015-05-20T13:29:35+08:00',
        ],],
        'wait_days_after_receive' => 7,
      ],
      'fixed_normal_coupon' => [
        'discount_amount' => 5,
        'transaction_minimum' => 100,
      ],
      'discount_coupon' => [
        'discount_percent' => 88,
        'transaction_minimum' => 100,
      ],
      'exchange_coupon' => [
        'exchange_price' => 100,
        'transaction_minimum' => 100,
      ],
      'use_method' => 'OFF_LINE',
      'mini_programs_appid' => 'wx23232232323',
      'mini_programs_path' => '/path/index/index',
    ],
    'stock_send_rule' => [
      'max_amount' => 100000,
      'max_coupons' => 100,
      'max_coupons_per_user' => 5,
      'max_amount_by_day' => 1000,
      'max_coupons_by_day' => 100,
      'natural_person_limit' => true,
      'prevent_api_abuse' => true,
      'transferable' => true,
      'shareable' => true,
    ],
    'out_request_no' => '100002322019090134234sfdf',
    'custom_entrance' => [
      'mini_programs_info' => [
        'mini_programs_appid' => 'wx234545656765876',
        'mini_programs_path' => '/path/index/index',
        'entrance_words' => '欢迎选购',
        'guiding_words' => '获取更多优惠',
      ],
      'appid' => 'wx324345hgfhfghfg',
      'hall_id' => '233455656',
      'store_id' => '233554655',
      'code_display_mode' => 'BARCODE',
    ],
    'display_pattern_info' => [
      'description' => 'xxx门店可用',
      'merchant_logo_url' => 'https://qpic.cn/xxx',
      'merchant_name' => '微信支付',
      'background_color' => 'Color020',
      'coupon_image_url' => 'https://qpic.cn/xxx',
      'finder_info' => [
        'finder_id' => 'sph6Rngt2T4RlUf',
        'finder_video_id' => 'sph6Rngt2T4RlUf',
        'finder_video_cover_image_url' => 'https://wxpaylogo.qpic.cn/xxx',
      ],
    ],
    'coupon_code_mode' => 'WECHATPAY_MODE',
    'notify_config' => [
      'notify_appid' => 'wx23232232323',
    ],
    'subsidy' => true,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/busifavor/stocks']->post([
  'json' => [
    'stock_name' => '8月1日活动券',
    'belong_merchant' => '10000022',
    'comment' => '活动使用',
    'goods_name' => 'xxx商品使用',
    'stock_type' => 'NORMAL',
    'coupon_use_rule' => [
      'coupon_available_time' => [
        'available_begin_time' => '2015-05-20T13:29:35+08:00',
        'available_end_time' => '2015-05-20T13:29:35+08:00',
        'available_day_after_receive' => 3,
        'available_week' => [
          'week_day' => [1, 2],
          'available_day_time' => [[
            'begin_time' => 3600,
            'end_time' => 86399,
          ],],
        ],
        'irregulary_avaliable_time' => [[
          'begin_time' => '2015-05-20T13:29:35+08:00',
          'end_time' => '2015-05-20T13:29:35+08:00',
        ],],
        'wait_days_after_receive' => 7,
      ],
      'fixed_normal_coupon' => [
        'discount_amount' => 5,
        'transaction_minimum' => 100,
      ],
      'discount_coupon' => [
        'discount_percent' => 88,
        'transaction_minimum' => 100,
      ],
      'exchange_coupon' => [
        'exchange_price' => 100,
        'transaction_minimum' => 100,
      ],
      'use_method' => 'OFF_LINE',
      'mini_programs_appid' => 'wx23232232323',
      'mini_programs_path' => '/path/index/index',
    ],
    'stock_send_rule' => [
      'max_amount' => 100000,
      'max_coupons' => 100,
      'max_coupons_per_user' => 5,
      'max_amount_by_day' => 1000,
      'max_coupons_by_day' => 100,
      'natural_person_limit' => true,
      'prevent_api_abuse' => true,
      'transferable' => true,
      'shareable' => true,
    ],
    'out_request_no' => '100002322019090134234sfdf',
    'custom_entrance' => [
      'mini_programs_info' => [
        'mini_programs_appid' => 'wx234545656765876',
        'mini_programs_path' => '/path/index/index',
        'entrance_words' => '欢迎选购',
        'guiding_words' => '获取更多优惠',
      ],
      'appid' => 'wx324345hgfhfghfg',
      'hall_id' => '233455656',
      'store_id' => '233554655',
      'code_display_mode' => 'BARCODE',
    ],
    'display_pattern_info' => [
      'description' => 'xxx门店可用',
      'merchant_logo_url' => 'https://qpic.cn/xxx',
      'merchant_name' => '微信支付',
      'background_color' => 'Color020',
      'coupon_image_url' => 'https://qpic.cn/xxx',
      'finder_info' => [
        'finder_id' => 'sph6Rngt2T4RlUf',
        'finder_video_id' => 'sph6Rngt2T4RlUf',
        'finder_video_cover_image_url' => 'https://wxpaylogo.qpic.cn/xxx',
      ],
    ],
    'coupon_code_mode' => 'WECHATPAY_MODE',
    'notify_config' => [
      'notify_appid' => 'wx23232232323',
    ],
    'subsidy' => true,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
stock_idstring批次号
create_timestring创建时间

参阅 官方文档

Published on the GitHub by TheNorthMemory