查询商品券批次列表
更新时间:2025.08.28品牌方可以通过该接口分页查询某个商品券的批次列表。
前置条件:已创建商品券
接口说明
支持商户:【品牌商户】
请求方式:【GET】/brand/marketing/product-coupon/product-coupons/{product_coupon_id}/stocks
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Wechatpay-Serial 必填 string
【微信支付公钥ID】 请传入brand_id对应的微信支付公钥ID,接口将会校验两者的关联关系,参考微信支付公钥产品简介及使用说明获取微信支付公钥ID和相关的介绍。以下两种场景将使用到微信支付公钥: 1、接收到接口的返回内容,需要使用微信支付公钥进行验签; 2、调用含有敏感信息参数(如姓名、身份证号码)的接口时,需要使用微信支付公钥加密敏感信息后再传输参数,加密指引请参考微信支付公钥加密敏感信息指引。
path 路径参数
product_coupon_id 必填 string
【商品券ID】 商品券的唯一标识,创建商品券时由微信支付生成
query 查询参数
state 选填 string
【批次状态】 不填默认查询所有状态的批次
可选取值
AUDITING
: 审批中SENDING
: 发放中PAUSED
: 已暂停STOPPED
: 已停止,当前已到达结束时间DEACTIVATED
: 已失效,品牌方主动调用失效接口使批次失效
page_size 选填 integer
【分页大小】 单次拉取的数据条数上限,不填默认为20,最大值50
page_token 选填 string
【分页Token】 分页查询时,需要传入上一次调用返回的 next_page_token
,首次调用不填
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/brand/marketing/product-coupon/product-coupons/200000001/stocks?state=SENDING&page_size=20&page_token=MTIzMjUK \ 3 -H "Authorization: WECHATPAY-BRAND-SHA256-RSA2048 brand_id=\"XXXX\",..." \ 4 -H "Accept: application/json" \ 5 -H "Wechatpay-Serial: PUB_KEY_ID_XXXX" 6
应答参数
200 OK
total_count 必填 integer
【总个数】 符合查询条件的批次总数,当且仅当 page_token
为空时提供
stock_list 选填 array[object]
【批次列表】 符合查询条件的批次列表
属性 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
product_coupon_id 必填 string(40) 【商品券ID】 商品券的唯一标识,由微信支付生成 stock_id 必填 string(40) 【批次ID】 商品券批次的唯一标识,由微信支付生成 remark 选填 string(20) 【备注】 仅配置品牌可见,用于自定义信息 coupon_code_mode 必填 string 【券Code分配模式】 决定发券时用户商品券Code如何产生 可选取值
coupon_code_count_info 选填 object 【品牌方预上传的券Code数量信息】 当且仅当
stock_send_rule 必填 object 【发放规则】 发放规则
single_usage_rule 选填 object 【单券使用规则】 当且仅当
sequential_usage_rule 选填 object 【多次优惠使用规则】 当且仅当
usage_rule_display_info 必填 object 【券使用规则展示信息】 券使用规则展示信息
coupon_display_info 必填 object 【用户商品券展示信息】 用户商品券在卡包中的展示详情,包括引导用户的自定义入口
notify_config 必填 object 【事件通知配置】 发生券相关事件时,微信支付会向品牌方发送通知,需要提供通知相关配置
store_scope 必填 string 【可用门店范围】 控制该批次可以在品牌下哪些门店使用 可选取值
sent_count_info 必填 object 【已发放次数】 本批次已发放次数
state 必填 string 【批次状态】 商品券批次状态 可选取值
deactivate_request_no 选填 string 【失效请求单号】 当且仅当 deactivate_time 选填 string 【失效时间】 当且仅当 deactivate_reason 选填 string 【失效原因】 当且仅当 |
next_page_token 选填 string(100)
【下一页Token】 分页查询时,如果还有更多数据,会返回下一页的Token,请在下一次查询时设置在 page_token
中;如果已无更多数据,则不返回此字段。
应答示例
200 OK
1{ 2 "total_count" : 100, 3 "stock_list" : [ 4 { 5 "product_coupon_id" : "200000001", 6 "stock_id" : "123456789", 7 "remark" : "满减券", 8 "coupon_code_mode" : "UPLOAD", 9 "coupon_code_count_info" : { 10 "total_count" : 10000, 11 "available_count" : 999 12 }, 13 "stock_send_rule" : { 14 "max_count" : 10000000, 15 "max_count_per_day" : 10000, 16 "max_count_per_user" : 1 17 }, 18 "single_usage_rule" : { 19 "coupon_available_period" : { 20 "available_begin_time" : "2025-01-01T00:00:00+08:00", 21 "available_end_time" : "2025-10-01T00:00:00+08:00", 22 "available_days" : 10, 23 "wait_days_after_receive" : 1, 24 "weekly_available_period" : { 25 "day_list" : [ 26 "MONDAY" 27 ], 28 "day_period_list" : [ 29 { 30 "begin_time" : 60, 31 "end_time" : 86399 32 } 33 ] 34 }, 35 "irregular_available_period_list" : [ 36 { 37 "begin_time" : "2025-01-01T00:00:00+08:00", 38 "end_time" : "2025-10-01T00:00:00+08:00" 39 } 40 ] 41 }, 42 "normal_coupon" : { 43 "threshold" : 10000, 44 "discount_amount" : 100 45 }, 46 "discount_coupon" : { 47 "threshold" : 10000, 48 "percent_off" : 30 49 }, 50 "exchange_coupon" : { 51 "threshold" : 10000, 52 "exchange_price" : 100 53 } 54 }, 55 "sequential_usage_rule" : { 56 "coupon_available_period" : { 57 "available_begin_time" : "2025-01-01T00:00:00+08:00", 58 "available_end_time" : "2025-10-01T00:00:00+08:00", 59 "wait_days_after_receive" : 1, 60 "weekly_available_period" : { 61 "day_list" : [ 62 "MONDAY" 63 ], 64 "day_period_list" : [ 65 { 66 "begin_time" : 60, 67 "end_time" : 86399 68 } 69 ] 70 }, 71 "irregular_available_period_list" : [ 72 { 73 "begin_time" : "2025-01-01T00:00:00+08:00", 74 "end_time" : "2025-10-01T00:00:00+08:00" 75 } 76 ] 77 }, 78 "normal_coupon_list" : [ 79 { 80 "threshold" : 10000, 81 "discount_amount" : 100 82 } 83 ], 84 "discount_coupon_list" : [ 85 { 86 "threshold" : 10000, 87 "percent_off" : 30 88 } 89 ], 90 "exchange_coupon_list" : [ 91 { 92 "threshold" : 10000, 93 "exchange_price" : 100 94 } 95 ], 96 "special_first" : false 97 }, 98 "usage_rule_display_info" : { 99 "coupon_usage_method_list" : [ 100 "MINI_PROGRAM" 101 ], 102 "mini_program_appid" : "wx1234567890", 103 "mini_program_path" : "/pages/index/product", 104 "app_path" : "https://www.example.com/jump-to-app", 105 "usage_description" : "全场可用", 106 "coupon_available_store_info" : { 107 "description" : "可在上海市区的所有门店使用,详细列表参考小程序内信息为准", 108 "mini_program_appid" : "wx1234567890", 109 "mini_program_path" : "/pages/index/store-list" 110 } 111 }, 112 "coupon_display_info" : { 113 "code_display_mode" : "QRCODE", 114 "background_color" : "Color010", 115 "entrance_mini_program" : { 116 "appid" : "wx1234567890", 117 "path" : "/pages/index/product", 118 "entrance_wording" : "欢迎选购", 119 "guidance_wording" : "获取更多优惠" 120 }, 121 "entrance_official_account" : { 122 "appid" : "wx1234567890" 123 }, 124 "entrance_finder" : { 125 "finder_id" : "gh_12345678", 126 "finder_video_id" : "UDFsdf24df34dD456Hdf34", 127 "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 128 } 129 }, 130 "notify_config" : { 131 "notify_appid" : "wx4fd12345678" 132 }, 133 "store_scope" : "SPECIFIC", 134 "sent_count_info" : { 135 "total_count" : 100, 136 "today_count" : 10 137 }, 138 "state" : "SENDING", 139 "deactivate_request_no" : "1002600620019090123143254436", 140 "deactivate_time" : "2025-01-01T00:00+08:00", 141 "deactivate_reason" : "批次信息有误,重新创建" 142 } 143 ], 144 "next_page_token" : "MTIzNDUK" 145} 146
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
业务错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
403 | NO_AUTH | 缺少业务相关权限 | 请确认已开通商品券权限 |
404 | NOT_FOUND | 未找到 product_coupon_id 对应的商品券 | 请确认 product_coupon_id 存在且属于当前品牌 |
429 | RATELIMIT_EXCEEDED | 请求超过接口频率限制 | 请稍后使用原参数重试 |