创建代金券批次
通过调用此接口可创建代金券批次,包括预充值&免充值类型。
请求参数 | 类型 | 描述 |
---|---|---|
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 | 样式信息 |
description | string | 使用说明 |
merchant_logo | string | 商户logo |
merchant_name | string | 商户名称 |
background_color | string | 背景颜色Color010 | Color020 | Color030 | Color040 | Color050 | Color060 | Color070 | Color080 | Color090 | Color100 枚举值之一 |
coupon_image | string | 券详情图片 |
coupon_use_rule | object | 核销规则 |
coupon_available_time | object | 券可核销时间 |
available_begin_time | string | 开始时间 |
available_end_time | string | 结束时间 |
fix_available_time | object | 固定时间段可用 |
available_week_day | integer[] | 可用星期数(0代表周日,1代表周一,以此类推)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 | 门槛 |
discount_coupon | object | 折扣券使用规则 |
discount_amount_max | integer | 最高折扣金额 |
discount_percent | integer | 折扣百分比 |
transaction_minimum | integer | 门槛 |
exchange_coupon | object | 换购券使用规则 |
exchange_price | integer | 单品换购价 |
transaction_minimum | integer | 消费门槛 |
goods_tag | string[] | 订单优惠标记 |
limit_pay | string[] | 指定支付方式 |
limit_card | object | 指定银行卡BIN |
name | string | 银行卡名称 |
bin | string[] | |
trade_type | string[] | 支付方式MICROAPP | APPPAY | PPAY | CARD | FACE | OTHER 枚举值之一 |
available_items | string[] | 可核销商品编码 |
unavailable_items | string[] | 不参与优惠商品编码 |
available_merchants | string[] | 可核销商户号 |
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' => 0,
'max_amount' => 0,
'max_amount_by_day' => 0,
'max_coupons_per_user' => 0,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'description' => '',
'merchant_logo' => '',
'merchant_name' => '',
'background_color' => 'Color010',
'coupon_image' => '',
],
'coupon_use_rule' => [
'coupon_available_time' => [
'available_begin_time' => '',
'available_end_time' => '',
'fix_available_time' => [
'available_week_day' => ['integer'],
'begin_time' => 3600,
'end_time' => 86399,
],
'second_day_available' => true,
'available_time_after_receive' => 0,
],
'fixed_normal_coupon' => [
'coupon_amount' => 0,
'transaction_minimum' => 0,
],
'discount_coupon' => [
'discount_amount_max' => 0,
'discount_percent' => 0,
'transaction_minimum' => 0,
],
'exchange_coupon' => [
'exchange_price' => 0,
'transaction_minimum' => 0,
],
'goods_tag' => ['string'],
'limit_pay' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
'trade_type' => ['string'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
],
'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' => 0,
'max_amount' => 0,
'max_amount_by_day' => 0,
'max_coupons_per_user' => 0,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'description' => '',
'merchant_logo' => '',
'merchant_name' => '',
'background_color' => 'Color010',
'coupon_image' => '',
],
'coupon_use_rule' => [
'coupon_available_time' => [
'available_begin_time' => '',
'available_end_time' => '',
'fix_available_time' => [
'available_week_day' => ['integer'],
'begin_time' => 3600,
'end_time' => 86399,
],
'second_day_available' => true,
'available_time_after_receive' => 0,
],
'fixed_normal_coupon' => [
'coupon_amount' => 0,
'transaction_minimum' => 0,
],
'discount_coupon' => [
'discount_amount_max' => 0,
'discount_percent' => 0,
'transaction_minimum' => 0,
],
'exchange_coupon' => [
'exchange_price' => 0,
'transaction_minimum' => 0,
],
'goods_tag' => ['string'],
'limit_pay' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
'trade_type' => ['string'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
],
'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' => 0,
'max_amount' => 0,
'max_amount_by_day' => 0,
'max_coupons_per_user' => 0,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'description' => '',
'merchant_logo' => '',
'merchant_name' => '',
'background_color' => 'Color010',
'coupon_image' => '',
],
'coupon_use_rule' => [
'coupon_available_time' => [
'available_begin_time' => '',
'available_end_time' => '',
'fix_available_time' => [
'available_week_day' => ['integer'],
'begin_time' => 3600,
'end_time' => 86399,
],
'second_day_available' => true,
'available_time_after_receive' => 0,
],
'fixed_normal_coupon' => [
'coupon_amount' => 0,
'transaction_minimum' => 0,
],
'discount_coupon' => [
'discount_amount_max' => 0,
'discount_percent' => 0,
'transaction_minimum' => 0,
],
'exchange_coupon' => [
'exchange_price' => 0,
'transaction_minimum' => 0,
],
'goods_tag' => ['string'],
'limit_pay' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
'trade_type' => ['string'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
],
'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' => 0,
'max_amount' => 0,
'max_amount_by_day' => 0,
'max_coupons_per_user' => 0,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'description' => '',
'merchant_logo' => '',
'merchant_name' => '',
'background_color' => 'Color010',
'coupon_image' => '',
],
'coupon_use_rule' => [
'coupon_available_time' => [
'available_begin_time' => '',
'available_end_time' => '',
'fix_available_time' => [
'available_week_day' => ['integer'],
'begin_time' => 3600,
'end_time' => 86399,
],
'second_day_available' => true,
'available_time_after_receive' => 0,
],
'fixed_normal_coupon' => [
'coupon_amount' => 0,
'transaction_minimum' => 0,
],
'discount_coupon' => [
'discount_amount_max' => 0,
'discount_percent' => 0,
'transaction_minimum' => 0,
],
'exchange_coupon' => [
'exchange_price' => 0,
'transaction_minimum' => 0,
],
'goods_tag' => ['string'],
'limit_pay' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
'trade_type' => ['string'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
],
'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' => 0,
'max_amount' => 0,
'max_amount_by_day' => 0,
'max_coupons_per_user' => 0,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'description' => '',
'merchant_logo' => '',
'merchant_name' => '',
'background_color' => 'Color010',
'coupon_image' => '',
],
'coupon_use_rule' => [
'coupon_available_time' => [
'available_begin_time' => '',
'available_end_time' => '',
'fix_available_time' => [
'available_week_day' => ['integer'],
'begin_time' => 3600,
'end_time' => 86399,
],
'second_day_available' => true,
'available_time_after_receive' => 0,
],
'fixed_normal_coupon' => [
'coupon_amount' => 0,
'transaction_minimum' => 0,
],
'discount_coupon' => [
'discount_amount_max' => 0,
'discount_percent' => 0,
'transaction_minimum' => 0,
],
'exchange_coupon' => [
'exchange_price' => 0,
'transaction_minimum' => 0,
],
'goods_tag' => ['string'],
'limit_pay' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
'trade_type' => ['string'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
],
'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' => 0,
'max_amount' => 0,
'max_amount_by_day' => 0,
'max_coupons_per_user' => 0,
'natural_person_limit' => true,
'prevent_api_abuse' => true,
],
'no_cash' => true,
'stock_type' => 'NORMAL',
'comment' => '零售批次',
'belong_merchant' => '98568865',
'pattern_info' => [
'description' => '',
'merchant_logo' => '',
'merchant_name' => '',
'background_color' => 'Color010',
'coupon_image' => '',
],
'coupon_use_rule' => [
'coupon_available_time' => [
'available_begin_time' => '',
'available_end_time' => '',
'fix_available_time' => [
'available_week_day' => ['integer'],
'begin_time' => 3600,
'end_time' => 86399,
],
'second_day_available' => true,
'available_time_after_receive' => 0,
],
'fixed_normal_coupon' => [
'coupon_amount' => 0,
'transaction_minimum' => 0,
],
'discount_coupon' => [
'discount_amount_max' => 0,
'discount_percent' => 0,
'transaction_minimum' => 0,
],
'exchange_coupon' => [
'exchange_price' => 0,
'transaction_minimum' => 0,
],
'goods_tag' => ['string'],
'limit_pay' => ['string'],
'limit_card' => [
'name' => '精粹白金',
'bin' => ['string'],
],
'trade_type' => ['string'],
'available_items' => ['string'],
'unavailable_items' => ['string'],
'available_merchants' => ['string'],
],
'out_request_no' => '',
'ext_info' => '{"exinfo1":"1234","exinfo2":"3456"}',
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
stock_id | string | 批次号 |
create_time | string | 创建时间 |
参阅 官方文档