API接口 https://api.mch.weixin.qq.com/v3/marketing/favor/coupon-stocks
body的数据:
{
"stock_name": "3元代金券",
"belong_merchant": "1556093731",
"available_begin_time": "2021-12-14T10:00:00.120+08:00",
"available_end_time": "2022-03-01T12:00:00.120+08:00",
"stock_use_rule": {
"max_coupons": 1000,
"max_amount": 300000,
"max_coupons_per_user": 1,
"natural_person_limit": false,
"prevent_api_abuse": false
},
"pattern_info": {
"description": "优麦团全场通用券(不包含外卖订单)",
"merchant_logo": "https://img.youmaituan.cn/youmaituan/images/20211213154601.png",
"merchant_name": "优麦团",
"background_color": "COLOR010"
},
"coupon_use_rule": {
"fixed_normal_coupon": {
"coupon_amount": 300,
"transaction_minimum": 301
},
"coupon_available_time": {
"available_time_after_receive" : 1440
},
"available_merchants": [
"1556093731"
]
},
"no_cash": true,
"stock_type": "NORMAL",
"out_request_no": "2021121319165757985599"
}';
遇到的问题:
当“available_begin_time” 设置为小于当前时间时,报错信息“批次开始时间必须大于当前时间”,
而当 “available_begin_time” 设置为大于当前时间时,报错信息“活动未开始或已结束”。
先确认一下这几个参数:
1.stock_name:最多可填写9个字
2.max_coupons_per_user:单天发放个数上限不能为0
3. coupon_amount:10<=coupon_amount<=100000
4.available_time_after_receive:可用时间:相对时间,按分钟设置,是否1min<=分钟范围<=1440min
5.transaction_minimum校验规则:
a、使用门槛-券面额>=0.01(门槛要大于面额)
b、0.1元<=门槛<=100000
6.stock_type:目前只支持NORMAL
7.out_request_no:校验规则:不可以重复
8、开始时间结束时间控制在90天内
9、不可使用的时间参数不可以传递
实际提示错误码报的不正确,请参考以下示例进行修改创建
长示例: { "stock_name": "耗子尾汁", "comment": "零售批次", "belong_merchant": "2480255141", "available_begin_time": "2020-12-1T15:40:35.120+08:00", "available_end_time": "2020-12-30T15:40:36.120+08:00", "stock_use_rule": { "max_coupons": 10, "max_amount": 5000, "max_amount_by_day": 500, "max_coupons_per_user": 1, "natural_person_limit": true, "prevent_api_abuse": true }, "pattern_info": { "description": "微信支付营销代金券", "merchant_logo": "https://wx.gtimg.com/mmpay_pub/KQwOuXiby6RR2Da2oGPMe4ZGjiaC8wdwZUNf9SageS77G8ibicGCdD6S9WIpEBbaibIbq/0", "merchant_name": "耗子尾汁", "background_color": "COLOR060", "coupon_image": "https://wx.gtimg.com/mmpay_pub/KQwOuXiby6RR2Da2oGPMe4ZGjiaC8wdwZUNf9SageS77G8ibicGCdD6S9WIpEBbaibIbq/0" }, "coupon_use_rule": { "fixed_normal_coupon": { "coupon_amount": 500, "transaction_minimum": 1000 }, "goods_tag": [ "my-test" ], "combine_use": true, "available_merchants": [ "2480255141" ], "limit_pay" :["CBHB_DEBIT"] }, "no_cash": false, "stock_type": "NORMAL", "out_request_no": "123333333-111100" } 短示例: { "stock_name": "GD测批次4", "comment": "验证活动", "belong_merchant": "xxxxxx", "available_begin_time": "2020-02-13T18:00:00.120+08:00", "available_end_time": "2020-02-20T23:59:59.120+08:00", "stock_use_rule": { "max_coupons": 10, "max_amount": 100, "max_coupons_per_user": 10, "natural_person_limit": false, "prevent_api_abuse": false }, "coupon_use_rule": { "fixed_normal_coupon": { "coupon_amount": 10, "transaction_minimum": 10 }, "available_merchants": [ "209784532", "221003827" ] }, "no_cash": false, "stock_type": "NORMAL", "out_request_no": "207662xxxxxx" }