# 添加优惠券

# 接口调用说明

http请求方式:POST
https://api.weixin.qq.com/shop/coupon/add?access_token=xxxxxxxxx

# 请求参数示例

{
  "coupon": {
    "out_coupon_id": "coupon_id_1",
    "type": 101,  
    "promote_type": 4,
    "coupon_info": {
      "name": "示例优惠券",
      "promote_info": {
        "promote_type": 4,  // 视频号
        "finder": {
          "nickname": "视频号昵称"
        }
      },
      "discount_info": {
        "discount_condition": {
          "product_cnt": 2,
          "product_price": 5000,
          "out_product_ids": [
            "product_id_3",
            "product_id_4"
          ],
          "tradein_info": {
            "out_product_id": "product_id_5",
            "price": 10000
          },
          "buyget_info": {
            "buy_out_product_id": "product_id_1",
            "buy_product_cnt": 3,
            "get_out_product_id": "product_id_2",
            "get_product_cnt": 2131241242
          }
        },
        "discount_num": 9800,
        "discount_fee": 6400
      },
      "receive_info": {
        "start_time": 1625451250,
        "end_time": 1625454250,
        "limit_num_one_person": 10,
        "total_num": 100
      },
      "valid_info": {
        "valid_type": 1,  // 1:商品指定时间区间,2:生效天数,3:生效秒数
        "valid_day_num": 10,
        "valid_second": 3600,
        "start_time": 1625451250,
        "end_time": 1625464250
      }
    }
  }
}

# 回包示例

{
    "errcode": 0
}

# 请求参数说明

参数 类型 是否必填 说明
coupon.out_coupon_id string 商家侧优惠券ID
coupon.type number 优惠券类型
coupon.promote_type number 优惠券推广类型
coupon.coupon_info.name string 优惠券名
coupon.coupon_info.promote_info.promote_type number 优惠券推广类型
coupon.coupon_info.promote_info.finder.nickname string 推广视频号昵称
coupon.coupon_info.discount_info.discount_condition.product_cnt number 优惠条件所需的商品数
coupon.coupon_info.discount_info.discount_condition.product_price number 优惠条件所需满足的金额
coupon.coupon_info.discount_info.discount_condition.out_product_ids string array 指定商品商家侧ID,商品券必需,最多128个
coupon.coupon_info.discount_info.discount_condition.tradein_info.out_product_id string 换购商品商家侧ID,换购券必需
coupon.coupon_info.discount_info.discount_condition.tradein_info.price number 需要支付的金额,单位分,换购券必需
coupon.coupon_info.discount_info.discount_condition.buyget_info.buy_out_product_id string 购买商品商家侧ID,买赠券必需
coupon.coupon_info.discount_info.discount_condition.buyget_info.buy_product_cnt number 购买商品数,买赠券必需
coupon.coupon_info.discount_info.discount_condition.buyget_info.get_out_product_id string 赠送商品商家侧ID,买赠券必需
coupon.coupon_info.discount_info.discount_condition.buyget_info.get_product_cnt number 赠送商品数,买赠券必需
coupon.coupon_info.discount_info.discount_num number 折扣数,比如5.1折,则填5100,折扣券必需(不可低于2折)
coupon.coupon_info.discount_info.discount_fee number 减金额,单位为分,直减券、满减券必需(不可超过200元,同时如果是商品券,适用商品优惠后不可低于原价2折,如果是店铺满减券,不可低于价格门槛的2折。)
coupon.coupon_info.receive_info.start_time number 领取开始时间 (秒级时间戳)
coupon.coupon_info.receive_info.end_time number 领取结束时间 (秒级时间戳)
coupon.coupon_info.receive_info.limit_num_one_person number 个人限领张数,只做展示,领券回调时接入方判断有无超领。
coupon.coupon_info.receive_info.total_num number 总发放量,即初始库存数,只做展示,领券回调时接入方判断有无超领。
coupon.coupon_info.valid_info.valid_type number 有效期类型,1:商品指定时间区间,2:生效天数,3:生效秒数
coupon.coupon_info.valid_info.valid_day_num number 生效天数,有效期类型为2时必需
coupon.coupon_info.valid_info.valid_second number 生效秒数,有效期类型为3时必需
coupon.coupon_info.valid_info.start_time number 生效开始时间(秒级时间戳) ,有效期类型为1时必需
coupon.coupon_info.valid_info.end_time number 生效结束时间(秒级时间戳) ,有效期类型为1时必需

# 注意

一张商品券最多关联128个商品

# 枚举-type

枚举值 描述
1 商品条件折扣券
2 商品满减券
3 商品统一折扣券
4 商品直减券
5 商品换购券
6 商品买赠券
101 店铺条件折扣券
102 店铺满减券
103 店铺统一折扣券
104 店铺直减券

# 枚举-promote_type

枚举值 描述
4 视频号直播