创建代金券批次
通过调用此接口可创建代金券批次,包括预充值&免充值类型。
| 请求参数 | 类型 | 描述 |
|---|---|---|
| json | object | 声明请求的JSON数据结构 |
| stock_name | string | 批次名称 |
| available_begin_time | string | 开始时间 |
| available_end_time | string | 结束时间 |
| stock_use_rule | object | 发放规则 |
| max_coupons | integer | 发放总上限 |
| max_amount | integer | 总预算 |
| max_amount_by_day | integer | 单天发放上限金额 |
| max_coupons_per_user | integer | 单个用户可领个数 |
| natural_person_limit | boolean | 是否开启自然人限制 |
| prevent_api_abuse | boolean | api发券防刷 |
| no_cash | boolean | 是否无资金流 |
| stock_type | string | 批次类型NORMAL | DISCOUNT | EXCHAHGE | RANDOM | DISCOUNT_CUT 枚举值之一 |
| comment | string | 批次备注 |
| belong_merchant | string | 归属商户号 |
| pattern_info | object | |
| jump_target | string | 卡包跳转目标PAYMENT_CODE | MINI_PROGRAM | DEFAULT_PAGE 枚举值之一 |
| mini_program_appid | string | 小程序appid |
| mini_program_path | string | 小程序path |
| description | string | 使用说明 |
| merchant_logo | string | 商户logo |
| merchant_name | string | 品牌名称 |
| background_color | string | 背景颜色COLOR010 | COLOR020 | COLOR030 | COLOR040 | COLOR050 | COLOR060 | COLOR070 | COLOR080 | COLOR081 | COLOR082 | COLOR090 | COLOR100 | COLOR101 | COLOR102 枚举值之一 |
| coupon_image | string | 券详情图片 |
| coupon_use_rule | object | |
| combine_use | boolean | 是否可叠加其他优惠 |
| coupon_available_time | object | 券生效时间 |
| fix_available_time | object | 固定时间段可用 |
| available_week_day | integer[] | 可用星期数0 | 1 | 2 | 3 | 4 | 5 | 6 枚举值之一 |
| begin_time | integer | 当天开始时间 |
| end_time | integer | 当天结束时间 |
| second_day_available | boolean | 领取第二天生效 |
| available_time_after_receive | integer | 领取后有效时间 |
| fixed_normal_coupon | object | 固定面额满减券使用规则 |
| coupon_amount | integer | 面额 |
| transaction_minimum | integer | 门槛 |
| goods_tag | string[] | 订单优惠标记 |
| trade_type | string[] | 指定支付模式MICROAPP | APPPAY | PPAY | CARD | FACE | OTHER 枚举值之一 |
| available_items | string[] | 可核销商品编码 |
| unavailable_items | string[] | 不参与优惠商品编码 |
| available_merchants | string[] | 可核销商户号 |
| limit_card | object | 指定银行卡BIN |
| name | string | 银行卡名字 |
| bin | string[] | 银行卡BIN |
| out_request_no | string | 商户单据号 |
| ext_info | string | 扩展属性 |
php
$instance->v3->marketing->favor->couponStocks->postAsync([
'json' => [
'stock_name' => '微信支付代金券批次',
'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
'available_end_time' => '2015-05-20T13:29:35.120+08:00',
'stock_use_rule' => [
'max_coupons' => 100,
'max_amount' => 5000,
'max_amount_by_day' => 400,
'max_coupons_per_user' => 3,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'jump_target' => 'PAYMENT_CODE',
'mini_program_appid' => 'wx23232232323',
'mini_program_path' => '/path/index/index',
'description' => '微信支付营销代金券',
'merchant_logo' => 'CDN地址',
'merchant_name' => '微信支付',
'background_color' => 'COLOR010',
'coupon_image' => 'https://qpic.cn/xxx',
],
'coupon_use_rule' => [
'combine_use' => true,
'coupon_available_time' => [
'fix_available_time' => [
'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
'begin_time' => 0,
'end_time' => 3600,
],
'second_day_available' => true,
'available_time_after_receive' => 7,
],
'fixed_normal_coupon' => [
'coupon_amount' => 100,
'transaction_minimum' => 100,
],
'goods_tag' => ['string'],
'trade_type' => ['MICROAPP'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
],
'out_request_no' => 'example_out_request_no',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/marketing/favor/coupon-stocks')->postAsync([
'json' => [
'stock_name' => '微信支付代金券批次',
'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
'available_end_time' => '2015-05-20T13:29:35.120+08:00',
'stock_use_rule' => [
'max_coupons' => 100,
'max_amount' => 5000,
'max_amount_by_day' => 400,
'max_coupons_per_user' => 3,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'jump_target' => 'PAYMENT_CODE',
'mini_program_appid' => 'wx23232232323',
'mini_program_path' => '/path/index/index',
'description' => '微信支付营销代金券',
'merchant_logo' => 'CDN地址',
'merchant_name' => '微信支付',
'background_color' => 'COLOR010',
'coupon_image' => 'https://qpic.cn/xxx',
],
'coupon_use_rule' => [
'combine_use' => true,
'coupon_available_time' => [
'fix_available_time' => [
'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
'begin_time' => 0,
'end_time' => 3600,
],
'second_day_available' => true,
'available_time_after_receive' => 7,
],
'fixed_normal_coupon' => [
'coupon_amount' => 100,
'transaction_minimum' => 100,
],
'goods_tag' => ['string'],
'trade_type' => ['MICROAPP'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
],
'out_request_no' => 'example_out_request_no',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/marketing/favor/coupon-stocks']->postAsync([
'json' => [
'stock_name' => '微信支付代金券批次',
'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
'available_end_time' => '2015-05-20T13:29:35.120+08:00',
'stock_use_rule' => [
'max_coupons' => 100,
'max_amount' => 5000,
'max_amount_by_day' => 400,
'max_coupons_per_user' => 3,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'jump_target' => 'PAYMENT_CODE',
'mini_program_appid' => 'wx23232232323',
'mini_program_path' => '/path/index/index',
'description' => '微信支付营销代金券',
'merchant_logo' => 'CDN地址',
'merchant_name' => '微信支付',
'background_color' => 'COLOR010',
'coupon_image' => 'https://qpic.cn/xxx',
],
'coupon_use_rule' => [
'combine_use' => true,
'coupon_available_time' => [
'fix_available_time' => [
'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
'begin_time' => 0,
'end_time' => 3600,
],
'second_day_available' => true,
'available_time_after_receive' => 7,
],
'fixed_normal_coupon' => [
'coupon_amount' => 100,
'transaction_minimum' => 100,
],
'goods_tag' => ['string'],
'trade_type' => ['MICROAPP'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
],
'out_request_no' => 'example_out_request_no',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->marketing->favor->couponStocks->post([
'json' => [
'stock_name' => '微信支付代金券批次',
'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
'available_end_time' => '2015-05-20T13:29:35.120+08:00',
'stock_use_rule' => [
'max_coupons' => 100,
'max_amount' => 5000,
'max_amount_by_day' => 400,
'max_coupons_per_user' => 3,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'jump_target' => 'PAYMENT_CODE',
'mini_program_appid' => 'wx23232232323',
'mini_program_path' => '/path/index/index',
'description' => '微信支付营销代金券',
'merchant_logo' => 'CDN地址',
'merchant_name' => '微信支付',
'background_color' => 'COLOR010',
'coupon_image' => 'https://qpic.cn/xxx',
],
'coupon_use_rule' => [
'combine_use' => true,
'coupon_available_time' => [
'fix_available_time' => [
'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
'begin_time' => 0,
'end_time' => 3600,
],
'second_day_available' => true,
'available_time_after_receive' => 7,
],
'fixed_normal_coupon' => [
'coupon_amount' => 100,
'transaction_minimum' => 100,
],
'goods_tag' => ['string'],
'trade_type' => ['MICROAPP'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
],
'out_request_no' => 'example_out_request_no',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/marketing/favor/coupon-stocks')->post([
'json' => [
'stock_name' => '微信支付代金券批次',
'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
'available_end_time' => '2015-05-20T13:29:35.120+08:00',
'stock_use_rule' => [
'max_coupons' => 100,
'max_amount' => 5000,
'max_amount_by_day' => 400,
'max_coupons_per_user' => 3,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'jump_target' => 'PAYMENT_CODE',
'mini_program_appid' => 'wx23232232323',
'mini_program_path' => '/path/index/index',
'description' => '微信支付营销代金券',
'merchant_logo' => 'CDN地址',
'merchant_name' => '微信支付',
'background_color' => 'COLOR010',
'coupon_image' => 'https://qpic.cn/xxx',
],
'coupon_use_rule' => [
'combine_use' => true,
'coupon_available_time' => [
'fix_available_time' => [
'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
'begin_time' => 0,
'end_time' => 3600,
],
'second_day_available' => true,
'available_time_after_receive' => 7,
],
'fixed_normal_coupon' => [
'coupon_amount' => 100,
'transaction_minimum' => 100,
],
'goods_tag' => ['string'],
'trade_type' => ['MICROAPP'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
],
'out_request_no' => 'example_out_request_no',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/marketing/favor/coupon-stocks']->post([
'json' => [
'stock_name' => '微信支付代金券批次',
'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
'available_end_time' => '2015-05-20T13:29:35.120+08:00',
'stock_use_rule' => [
'max_coupons' => 100,
'max_amount' => 5000,
'max_amount_by_day' => 400,
'max_coupons_per_user' => 3,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'jump_target' => 'PAYMENT_CODE',
'mini_program_appid' => 'wx23232232323',
'mini_program_path' => '/path/index/index',
'description' => '微信支付营销代金券',
'merchant_logo' => 'CDN地址',
'merchant_name' => '微信支付',
'background_color' => 'COLOR010',
'coupon_image' => 'https://qpic.cn/xxx',
],
'coupon_use_rule' => [
'combine_use' => true,
'coupon_available_time' => [
'fix_available_time' => [
'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
'begin_time' => 0,
'end_time' => 3600,
],
'second_day_available' => true,
'available_time_after_receive' => 7,
],
'fixed_normal_coupon' => [
'coupon_amount' => 100,
'transaction_minimum' => 100,
],
'goods_tag' => ['string'],
'trade_type' => ['MICROAPP'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
],
'out_request_no' => 'example_out_request_no',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| stock_id | string | 批次号 |
| create_time | string | 创建时间 |