查询商品券批次列表

更新时间:2025.08.28

品牌方可以通过该接口分页查询某个商品券的批次列表。可以传入 stock_bundle_id 来查询某个批次组内的批次列表。

前置条件:已创建商品券

频率限制:20/s

接口说明

支持商户:【品牌商户】

请求方式:【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,首次调用不填


 stock_bundle_id  选填   string

【批次组ID】 商品券批次组的唯一标识,【创建商品券(多次优惠)】或【添加商品券批次组】时由微信支付生成。

请求示例

curl
Java
Go

GET

查询商品券下已失效的批次列表

1curl -X GET \
2  https://api.mch.weixin.qq.com/brand/marketing/product-coupon/product-coupons/1000000013/stocks?state=DEACTIVATED&page_size=10 \
3  -H "Authorization: WECHATPAY-BRAND-SHA256-RSA2048 brand_id=\"XXXX\",..." \
4  -H "Accept: application/json" \
5  -H "Wechatpay-Serial: PUB_KEY_ID_XXXX"  
6

查询商品券下某个批次组内的批次

1curl -X GET \
2  https://api.mch.weixin.qq.com/brand/marketing/product-coupon/product-coupons/1000000014/stocks?page_size=20&stock_bundle_id=712315129419284901 \
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]

【批次列表】 符合查询条件的批次列表

属性

 next_page_token  选填   string(100)

【下一页Token】 分页查询时,如果还有更多数据,会返回下一页的Token,请在下一次查询时设置在 page_token 中;如果已无更多数据,则不返回此字段。

应答示例

200 OK

查询商品券下已失效的批次列表

1{
2  "total_count" : 1,
3  "stock_list" : [
4    {
5      "product_coupon_id" : "1000000013",
6      "stock_id" : "1000000013001",
7      "remark" : "8月工作日有效批次",
8      "coupon_code_mode" : "UPLOAD",
9      "coupon_code_count_info" : {
10        "total_count" : 0,
11        "available_count" : 0
12      },
13      "stock_send_rule" : {
14        "max_count" : 10000000,
15        "max_count_per_user" : 1
16      },
17      "single_usage_rule" : {
18        "coupon_available_period" : {
19          "available_begin_time" : "2025-08-01T00:00:00+08:00",
20          "available_end_time" : "2025-08-31T23:59:59+08:00",
21          "available_days" : 30,
22          "weekly_available_period" : {
23            "day_list" : [
24              "MONDAY",
25              "TUESDAY",
26              "WEDNESDAY",
27              "THURSDAY",
28              "FRIDAY"
29            ]
30          }
31        }
32      },
33      "usage_rule_display_info" : {
34        "coupon_usage_method_list" : [
35          "OFFLINE",
36          "MINI_PROGRAM",
37          "PAYMENT_CODE"
38        ],
39        "mini_program_appid" : "wx1234567890",
40        "mini_program_path" : "/pages/index/product",
41        "usage_description" : "工作日可用",
42        "coupon_available_store_info" : {
43          "description" : "所有门店可用,可使用小程序查看门店列表",
44          "mini_program_appid" : "wx1234567890",
45          "mini_program_path" : "/pages/index/store-list"
46        }
47      },
48      "coupon_display_info" : {
49        "code_display_mode" : "QRCODE",
50        "background_color" : "Color010",
51        "entrance_mini_program" : {
52          "appid" : "wx1234567890",
53          "path" : "/pages/index/product",
54          "entrance_wording" : "欢迎选购",
55          "guidance_wording" : "获取更多优惠"
56        },
57        "entrance_official_account" : {
58          "appid" : "wx1234567890"
59        },
60        "entrance_finder" : {
61          "finder_id" : "gh_12345678",
62          "finder_video_id" : "UDFsdf24df34dD456Hdf34",
63          "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"
64        }
65      },
66      "notify_config" : {
67        "notify_appid" : "wx4fd12345678"
68      },
69      "store_scope" : "ALL",
70      "sent_count_info" : {
71        "total_count" : 0,
72        "today_count" : 0
73      },
74      "state" : "DEACTIVATED",
75      "deactivate_request_no" : "de_34657_20250101_123456",
76      "deactivate_reason" : "批次信息有误,重新创建",
77      "deactivate_time" : "2025-09-01T00:00:00+08:00"
78    }
79  ]
80}
81

查询商品券下某个批次组内的批次

1{
2  "total_count" : 3,
3  "stock_list" : [
4    {
5      "product_coupon_id" : "1000000014",
6      "stock_id" : "1000000014001",
7      "remark" : "8月工作日有效批次",
8      "coupon_code_mode" : "UPLOAD",
9      "coupon_code_count_info" : {
10        "total_count" : 0,
11        "available_count" : 0
12      },
13      "stock_send_rule" : {
14        "max_count" : 10000000,
15        "max_count_per_user" : 1
16      },
17      "progressive_bundle_usage_rule" : {
18        "coupon_available_period" : {
19          "available_begin_time" : "2025-08-01T00:00:00+08:00",
20          "available_end_time" : "2025-08-31T23:59:59+08:00",
21          "available_days" : 30,
22          "weekly_available_period" : {
23            "day_list" : [
24              "MONDAY",
25              "TUESDAY",
26              "WEDNESDAY",
27              "THURSDAY",
28              "FRIDAY"
29            ]
30          }
31        },
32        "discount_coupon" : {
33          "threshold" : 10000,
34          "percent_off" : 50
35        }
36      },
37      "stock_bundle_info" : {
38        "stock_bundle_id" : "712315129419284901",
39        "stock_bundle_index" : 0
40      },
41      "usage_rule_display_info" : {
42        "coupon_usage_method_list" : [
43          "OFFLINE",
44          "MINI_PROGRAM",
45          "PAYMENT_CODE"
46        ],
47        "mini_program_appid" : "wx1234567890",
48        "mini_program_path" : "/pages/index/product",
49        "usage_description" : "工作日可用",
50        "coupon_available_store_info" : {
51          "description" : "所有门店可用,可使用小程序查看门店列表",
52          "mini_program_appid" : "wx1234567890",
53          "mini_program_path" : "/pages/index/store-list"
54        }
55      },
56      "coupon_display_info" : {
57        "code_display_mode" : "QRCODE",
58        "background_color" : "Color010",
59        "entrance_mini_program" : {
60          "appid" : "wx1234567890",
61          "path" : "/pages/index/product",
62          "entrance_wording" : "欢迎选购",
63          "guidance_wording" : "获取更多优惠"
64        },
65        "entrance_official_account" : {
66          "appid" : "wx1234567890"
67        },
68        "entrance_finder" : {
69          "finder_id" : "gh_12345678",
70          "finder_video_id" : "UDFsdf24df34dD456Hdf34",
71          "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"
72        }
73      },
74      "notify_config" : {
75        "notify_appid" : "wx4fd12345678"
76      },
77      "store_scope" : "NONE",
78      "sent_count_info" : {
79        "total_count" : 0,
80        "today_count" : 0
81      },
82      "state" : "SENDING"
83    },
84    {
85      "product_coupon_id" : "1000000014",
86      "stock_id" : "1000000014002",
87      "remark" : "8月工作日有效批次",
88      "coupon_code_mode" : "UPLOAD",
89      "coupon_code_count_info" : {
90        "total_count" : 0,
91        "available_count" : 0
92      },
93      "stock_send_rule" : {
94        "max_count" : 10000000,
95        "max_count_per_user" : 1
96      },
97      "progressive_bundle_usage_rule" : {
98        "coupon_available_period" : {
99          "available_begin_time" : "2025-08-01T00:00:00+08:00",
100          "available_end_time" : "2025-08-31T23:59:59+08:00",
101          "available_days" : 30,
102          "weekly_available_period" : {
103            "day_list" : [
104              "MONDAY",
105              "TUESDAY",
106              "WEDNESDAY",
107              "THURSDAY",
108              "FRIDAY"
109            ]
110          }
111        },
112        "discount_coupon" : {
113          "threshold" : 10000,
114          "percent_off" : 20
115        }
116      },
117      "stock_bundle_info" : {
118        "stock_bundle_id" : "712315129419284901",
119        "stock_bundle_index" : 1
120      },
121      "usage_rule_display_info" : {
122        "coupon_usage_method_list" : [
123          "OFFLINE",
124          "MINI_PROGRAM",
125          "PAYMENT_CODE"
126        ],
127        "mini_program_appid" : "wx1234567890",
128        "mini_program_path" : "/pages/index/product",
129        "usage_description" : "工作日可用",
130        "coupon_available_store_info" : {
131          "description" : "所有门店可用,可使用小程序查看门店列表",
132          "mini_program_appid" : "wx1234567890",
133          "mini_program_path" : "/pages/index/store-list"
134        }
135      },
136      "coupon_display_info" : {
137        "code_display_mode" : "QRCODE",
138        "background_color" : "Color010",
139        "entrance_mini_program" : {
140          "appid" : "wx1234567890",
141          "path" : "/pages/index/product",
142          "entrance_wording" : "欢迎选购",
143          "guidance_wording" : "获取更多优惠"
144        },
145        "entrance_official_account" : {
146          "appid" : "wx1234567890"
147        },
148        "entrance_finder" : {
149          "finder_id" : "gh_12345678",
150          "finder_video_id" : "UDFsdf24df34dD456Hdf34",
151          "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"
152        }
153      },
154      "notify_config" : {
155        "notify_appid" : "wx4fd12345678"
156      },
157      "store_scope" : "NONE",
158      "sent_count_info" : {
159        "total_count" : 0,
160        "today_count" : 0
161      },
162      "state" : "SENDING"
163    },
164    {
165      "product_coupon_id" : "1000000014",
166      "stock_id" : "1000000014003",
167      "remark" : "8月工作日有效批次",
168      "coupon_code_mode" : "UPLOAD",
169      "coupon_code_count_info" : {
170        "total_count" : 0,
171        "available_count" : 0
172      },
173      "stock_send_rule" : {
174        "max_count" : 10000000,
175        "max_count_per_user" : 1
176      },
177      "progressive_bundle_usage_rule" : {
178        "coupon_available_period" : {
179          "available_begin_time" : "2025-08-01T00:00:00+08:00",
180          "available_end_time" : "2025-08-31T23:59:59+08:00",
181          "available_days" : 30,
182          "weekly_available_period" : {
183            "day_list" : [
184              "MONDAY",
185              "TUESDAY",
186              "WEDNESDAY",
187              "THURSDAY",
188              "FRIDAY"
189            ]
190          }
191        },
192        "discount_coupon" : {
193          "threshold" : 10000,
194          "percent_off" : 30
195        }
196      },
197      "stock_bundle_info" : {
198        "stock_bundle_id" : "712315129419284901",
199        "stock_bundle_index" : 2
200      },
201      "usage_rule_display_info" : {
202        "coupon_usage_method_list" : [
203          "OFFLINE",
204          "MINI_PROGRAM",
205          "PAYMENT_CODE"
206        ],
207        "mini_program_appid" : "wx1234567890",
208        "mini_program_path" : "/pages/index/product",
209        "usage_description" : "工作日可用",
210        "coupon_available_store_info" : {
211          "description" : "所有门店可用,可使用小程序查看门店列表",
212          "mini_program_appid" : "wx1234567890",
213          "mini_program_path" : "/pages/index/store-list"
214        }
215      },
216      "coupon_display_info" : {
217        "code_display_mode" : "QRCODE",
218        "background_color" : "Color010",
219        "entrance_mini_program" : {
220          "appid" : "wx1234567890",
221          "path" : "/pages/index/product",
222          "entrance_wording" : "欢迎选购",
223          "guidance_wording" : "获取更多优惠"
224        },
225        "entrance_official_account" : {
226          "appid" : "wx1234567890"
227        },
228        "entrance_finder" : {
229          "finder_id" : "gh_12345678",
230          "finder_video_id" : "UDFsdf24df34dD456Hdf34",
231          "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"
232        }
233      },
234      "notify_config" : {
235        "notify_appid" : "wx4fd12345678"
236      },
237      "store_scope" : "NONE",
238      "sent_count_info" : {
239        "total_count" : 0,
240        "today_count" : 0
241      },
242      "state" : "SENDING"
243    }
244  ]
245}
246

 

错误码

以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示

状态码

错误码

描述

解决方案

400

PARAM_ERROR

参数错误

请根据错误提示正确传入参数

400

INVALID_REQUEST

HTTP 请求不符合微信支付 APIv3 接口规则

请参阅 接口规则

401

SIGN_ERROR

验证不通过

请参阅 签名常见问题

500

SYSTEM_ERROR

系统异常,请稍后重试

请稍后重试

400

INVALID_REQUEST

单券使用模式的商品券批次,应该在「单券使用规则」中包含对应类型的优惠规则。对于文档中标记不应填写的优惠规则应删除。

请在「单券使用规则」中包含对应类型的优惠规则,并删除文档中标记不应填写的优惠规则。

400

INVALID_REQUEST

多次优惠使用模式的商品券批次,应该在「多次优惠使用规则」中包含对应类型的优惠规则,且数量与多次优惠的优惠次数相等

在「多次优惠使用规则」中包含对应类型的优惠规则,且数量与多次优惠的优惠次数相等

400

INVALID_REQUEST

单品满减券或单品折扣券不应在商品券中设置「满减券使用规则」或「折扣券使用规则」,而是应该在商品券批次中设置

请删除商品券中的「满减券使用规则」或「折扣券使用规则」,并在商品券批次中设置对应的优惠规则

403

NO_AUTH

品牌没有此接口权限

品牌没有此接口权限

400

PARAM_ERROR

page_token 不合法,请确认 page_token 来自于上一个列表查询请求的 next_page_token

请确认 page_token 来自于上一个列表查询请求的 next_page_token,如果是初次查询则不要填写 page_token 参数

400

INVALID_REQUEST

商品券支持APP核销时,必须提供「APP跳转路径」

请提供「APP跳转路径」参数

400

PARAM_ERROR

分页大小超出限制,请根据接口文档调整到允许的范围

请调整分页大小到规定范围

400

INVALID_REQUEST

商品券支持小程序核销时,必须提供「小程序AppID」

请提供「小程序AppID」

400

INVALID_REQUEST

单品券必须提供商品原价,请补充

请补充商品原价

400

INVALID_REQUEST

商品券支持小程序核销时,必须提供「小程序跳转路径」

请提供提供「小程序跳转路径」

400

INVALID_REQUEST

单品券必须提供商品券套餐组合信息,请补充

请提供商品券套餐组合信息

400

PARAM_ERROR

时间字符串格式错误,请使用 RFC3339 标准格式

请使用 RFC3339 标准格式

400

INVALID_REQUEST

单券模式下,全场折扣券应在商品券中提供折扣券使用规则信息

请在商品券中提供「折扣券使用规则信息」

400

INVALID_REQUEST

单券模式下,全场满减券应在商品券中提供满减券使用规则信息

请在商品券中提供「满减券使用规则信息」

400

INVALID_REQUEST

每周固定可用时间(weekly_available_period)中提供当天可用时间段时(day_period_list),每周可用星期数(day_list)必填

请补充 每周可用星期数(day_list)

400

INVALID_REQUEST

单券模式下,全场券需要提供「单券模式信息(single_usage_info)」

请提供单券模式信息(single_usage_info)

400

INVALID_REQUEST

多次优惠模式下必须提供「多次优惠模式信息(sequential_usage_info)」

请填写 多次优惠模式信息(sequential_usage_info)

400

INVALID_REQUEST

传入的OpenID不合法

请使用参数 AppID 对应的的OpenID

 

元宝AI
反馈
目录
置顶