创建商家券
商户可以通过该接口创建商家券。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
stock_name | string | 商家券批次名称 |
belong_merchant | string | 批次归属商户号 |
comment | string | 批次备注 |
goods_name | string | 适用商品范围 |
stock_type | string | 批次类型 |
coupon_use_rule | object | 核销规则 |
coupon_available_time | object | 券可核销时间 |
available_begin_time | string | 开始时间 |
available_end_time | string | 结束时间 |
available_day_after_receive | integer | 生效后N天内有效 |
available_week | object | 固定周期有效时间段 |
week_day | string[] | 可用星期数 |
available_day_time | object[] | 当天可用时间段 |
begin_time | integer | 当天可用开始时间 |
end_time | integer | 当天可用结束时间 |
irregulary_avaliable_time | object[] | 无规律的有效时间段 |
begin_time | string | 开始时间 |
end_time | string | 结束时间 |
wait_days_after_receive | integer | 领取后N天开始生效 |
fixed_normal_coupon | object | 固定面额满减券使用规则 |
discount_amount | integer | 优惠金额 |
transaction_minimum | integer | 消费门槛 |
discount_coupon | object | 折扣券使用规则 |
discount_percent | integer | 折扣比例 |
transaction_minimum | integer | 消费门槛 |
exchange_coupon | object | 换购券使用规则 |
exchange_price | integer | 单品换购价 |
transaction_minimum | integer | 消费门槛 |
use_method | string | 核销方式 |
mini_programs_appid | string | 小程序appid |
mini_programs_path | string | 小程序path |
stock_send_rule | object | 发放规则 |
max_amount | number | 批次总预算 |
max_coupons | integer | 批次最大发放个数 |
max_coupons_per_user | integer | 用户最大可领个数 |
max_amount_by_day | number | 单天发放上限金额 |
max_coupons_by_day | integer | 单天发放上限个数 |
natural_person_limit | boolean | 是否开启自然人限制 |
prevent_api_abuse | boolean | 可疑账号拦截 |
transferable | boolean | 是否允许转赠 |
shareable | boolean | 是否允许分享链接 |
out_request_no | string | 商户请求单号 |
custom_entrance | object | 自定义入口 |
mini_programs_info | object | 小程序入口 |
mini_programs_appid | string | 商家小程序appid |
mini_programs_path | string | 商家小程序path |
entrance_words | string | 入口文案 |
guiding_words | string | 引导文案 |
appid | string | 商户公众号appid |
hall_id | string | 营销馆id |
store_id | string | 可用门店id |
code_display_mode | string | code展示模式 |
display_pattern_info | object | 样式信息 |
description | string | 使用须知 |
merchant_logo_url | string | 商户logo |
merchant_name | string | 商户名称 |
background_color | string | 背景颜色 |
coupon_image_url | string | 券详情图片 |
finder_info | object | 视频号相关信息 |
finder_id | string | 视频号ID |
finder_video_id | string | 视频号视频ID |
finder_video_cover_image_url | string | 视频号封面图 |
coupon_code_mode | string | 券code模式 |
notify_config | object | 事件通知配置 |
notify_appid | string | 事件通知appid |
subsidy | boolean | 是否允许营销补贴 |
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_id | string | 批次号 |
create_time | string | 创建时间 |
参阅 官方文档