查询商品券
更新时间:2025.08.04品牌方可以通过该接口查询商品券的详细信息,但不包括商品券的批次信息。
如果要查询商品券的批次列表,请使用【查询商品券批次列表API】
前置条件:已创建商品券
接口说明
支持商户:【普通服务商】
请求方式:【GET】/v3/marketing/partner/product-coupon/product-coupons/{product_coupon_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
path 路径参数
product_coupon_id 必填 string
【商品券ID】 商品券的唯一标识,创建商品券时由微信支付生成
query 查询参数
brand_id 必填 string
【品牌ID】 微信支付为品牌方分配的唯一标识,该品牌应与服务商存在授权关系
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/marketing/partner/product-coupon/product-coupons/200000001?brand_id=120344 \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" 5
需配合微信支付工具库 WXPayUtility 使用,请参考 Java
1package com.java.demo; 2 3import com.java.utils.WXPayUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/v3/partner/4014985777 4 5import com.google.gson.annotations.SerializedName; 6import com.google.gson.annotations.Expose; 7import okhttp3.MediaType; 8import okhttp3.OkHttpClient; 9import okhttp3.Request; 10import okhttp3.RequestBody; 11import okhttp3.Response; 12 13import java.io.IOException; 14import java.io.UncheckedIOException; 15import java.security.PrivateKey; 16import java.security.PublicKey; 17import java.util.ArrayList; 18import java.util.HashMap; 19import java.util.List; 20import java.util.Map; 21 22/** 23 * 查询商品券 24 */ 25public class GetProductCoupon { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/marketing/partner/product-coupon/product-coupons/{product_coupon_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 GetProductCoupon client = new GetProductCoupon( 33 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 34 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 35 "/path/to/apiclient_key.pem" // 商户API证书私钥文件路径,本地文件路径 36 , 37 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 38 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 39 ); 40 41 GetProductCouponRequest request = new GetProductCouponRequest(); 42 request.productCouponId = "200000001"; 43 request.brandId = "120344"; 44 try { 45 ProductCouponEntity response = client.run(request); 46 // TODO: 请求成功,继续业务逻辑 47 System.out.println(response); 48 } catch (WXPayUtility.ApiException e) { 49 // TODO: 请求失败,根据状态码执行不同的逻辑 50 e.printStackTrace(); 51 } 52 } 53 54 public ProductCouponEntity run(GetProductCouponRequest request) { 55 String uri = PATH; 56 uri = uri.replace("{product_coupon_id}", WXPayUtility.urlEncode(request.productCouponId)); 57 Map<String, Object> args = new HashMap<>(); 58 args.put("brand_id", request.brandId); 59 uri = uri + "?" + WXPayUtility.urlEncode(args); 60 61 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 62 reqBuilder.addHeader("Accept", "application/json"); 63 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 64 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 65 reqBuilder.method(METHOD, null); 66 Request httpRequest = reqBuilder.build(); 67 68 // 发送HTTP请求 69 OkHttpClient client = new OkHttpClient.Builder().build(); 70 try (Response httpResponse = client.newCall(httpRequest).execute()) { 71 String respBody = WXPayUtility.extractBody(httpResponse); 72 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 73 // 2XX 成功,验证应答签名 74 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 75 httpResponse.headers(), respBody); 76 77 // 从HTTP应答报文构建返回数据 78 return WXPayUtility.fromJson(respBody, ProductCouponEntity.class); 79 } else { 80 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 81 } 82 } catch (IOException e) { 83 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 84 } 85 } 86 87 private final String mchid; 88 private final String certificateSerialNo; 89 private final PrivateKey privateKey; 90 private final String wechatPayPublicKeyId; 91 private final PublicKey wechatPayPublicKey; 92 93 public GetProductCoupon(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 94 this.mchid = mchid; 95 this.certificateSerialNo = certificateSerialNo; 96 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 97 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 98 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 99 } 100 101 public static class GetProductCouponRequest { 102 @SerializedName("product_coupon_id") 103 @Expose(serialize = false) 104 public String productCouponId; 105 106 @SerializedName("brand_id") 107 @Expose(serialize = false) 108 public String brandId; 109 } 110 111 public static class ProductCouponEntity { 112 @SerializedName("product_coupon_id") 113 public String productCouponId; 114 115 @SerializedName("scope") 116 public ProductCouponScope scope; 117 118 @SerializedName("type") 119 public ProductCouponType type; 120 121 @SerializedName("usage_mode") 122 public UsageMode usageMode; 123 124 @SerializedName("single_usage_info") 125 public SingleUsageInfo singleUsageInfo; 126 127 @SerializedName("sequential_usage_info") 128 public SequentialUsageInfo sequentialUsageInfo; 129 130 @SerializedName("display_info") 131 public ProductCouponDisplayInfo displayInfo; 132 133 @SerializedName("out_product_no") 134 public String outProductNo; 135 136 @SerializedName("state") 137 public ProductCouponState state; 138 139 @SerializedName("deactivate_request_no") 140 public String deactivateRequestNo; 141 142 @SerializedName("deactivate_time") 143 public String deactivateTime; 144 145 @SerializedName("deactivate_reason") 146 public String deactivateReason; 147 148 @SerializedName("brand_id") 149 public String brandId; 150 } 151 152 public enum ProductCouponScope { 153 @SerializedName("ALL") 154 ALL, 155 @SerializedName("SINGLE") 156 SINGLE 157 } 158 159 public enum ProductCouponType { 160 @SerializedName("NORMAL") 161 NORMAL, 162 @SerializedName("DISCOUNT") 163 DISCOUNT, 164 @SerializedName("EXCHANGE") 165 EXCHANGE 166 } 167 168 public enum UsageMode { 169 @SerializedName("SINGLE") 170 SINGLE, 171 @SerializedName("SEQUENTIAL") 172 SEQUENTIAL 173 } 174 175 public static class SingleUsageInfo { 176 @SerializedName("normal_coupon") 177 public NormalCouponUsageRule normalCoupon; 178 179 @SerializedName("discount_coupon") 180 public DiscountCouponUsageRule discountCoupon; 181 } 182 183 public static class SequentialUsageInfo { 184 @SerializedName("type") 185 public SequentialUsageType type; 186 187 @SerializedName("count") 188 public Long count; 189 190 @SerializedName("available_days") 191 public Long availableDays; 192 193 @SerializedName("interval_days") 194 public Long intervalDays; 195 } 196 197 public static class ProductCouponDisplayInfo { 198 @SerializedName("name") 199 public String name; 200 201 @SerializedName("image_url") 202 public String imageUrl; 203 204 @SerializedName("background_url") 205 public String backgroundUrl; 206 207 @SerializedName("detail_image_url_list") 208 public List<String> detailImageUrlList; 209 210 @SerializedName("original_price") 211 public Long originalPrice; 212 213 @SerializedName("combo_package_list") 214 public List<ComboPackage> comboPackageList; 215 } 216 217 public enum ProductCouponState { 218 @SerializedName("AUDITING") 219 AUDITING, 220 @SerializedName("EFFECTIVE") 221 EFFECTIVE, 222 @SerializedName("DEACTIVATED") 223 DEACTIVATED 224 } 225 226 public static class NormalCouponUsageRule { 227 @SerializedName("threshold") 228 public Long threshold; 229 230 @SerializedName("discount_amount") 231 public Long discountAmount; 232 } 233 234 public static class DiscountCouponUsageRule { 235 @SerializedName("threshold") 236 public Long threshold; 237 238 @SerializedName("percent_off") 239 public Long percentOff; 240 } 241 242 public enum SequentialUsageType { 243 @SerializedName("INCREMENTAL") 244 INCREMENTAL, 245 @SerializedName("EQUAL") 246 EQUAL 247 } 248 249 public static class ComboPackage { 250 @SerializedName("name") 251 public String name; 252 253 @SerializedName("pick_count") 254 public Long pickCount; 255 256 @SerializedName("choice_list") 257 public List<ComboPackageChoice> choiceList = new ArrayList<ComboPackageChoice>(); 258 } 259 260 public static class ComboPackageChoice { 261 @SerializedName("name") 262 public String name; 263 264 @SerializedName("price") 265 public Long price; 266 267 @SerializedName("count") 268 public Long count; 269 270 @SerializedName("image_url") 271 public String imageUrl; 272 273 @SerializedName("mini_program_appid") 274 public String miniProgramAppid; 275 276 @SerializedName("mini_program_path") 277 public String miniProgramPath; 278 } 279 280} 281
需配合微信支付工具库 wxpay_utility 使用,请参考 Go
1package main 2 3import ( 4 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446 5 "encoding/json" 6 "fmt" 7 "net/http" 8 "net/url" 9 "strings" 10) 11 12func main() { 13 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 14 config, err := wxpay_utility.CreateMchConfig( 15 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 16 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 17 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 18 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 19 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 20 ) 21 if err != nil { 22 fmt.Println(err) 23 return 24 } 25 26 request := &GetProductCouponRequest{ 27 ProductCouponId: wxpay_utility.String("200000001"), 28 BrandId: wxpay_utility.String("120344"), 29 } 30 31 response, err := GetProductCoupon(config, request) 32 if err != nil { 33 fmt.Printf("请求失败: %+v\n", err) 34 // TODO: 请求失败,根据状态码执行不同的处理 35 return 36 } 37 38 // TODO: 请求成功,继续业务逻辑 39 fmt.Printf("请求成功: %+v\n", response) 40} 41 42func GetProductCoupon(config *wxpay_utility.MchConfig, request *GetProductCouponRequest) (response *ProductCouponEntity, err error) { 43 const ( 44 host = "https://api.mch.weixin.qq.com" 45 method = "GET" 46 path = "/v3/marketing/partner/product-coupon/product-coupons/{product_coupon_id}" 47 ) 48 49 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 50 if err != nil { 51 return nil, err 52 } 53 reqUrl.Path = strings.Replace(reqUrl.Path, "{product_coupon_id}", url.PathEscape(*request.ProductCouponId), -1) 54 query := reqUrl.Query() 55 if request.BrandId != nil { 56 query.Add("brand_id", *request.BrandId) 57 } 58 reqUrl.RawQuery = query.Encode() 59 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 60 if err != nil { 61 return nil, err 62 } 63 httpRequest.Header.Set("Accept", "application/json") 64 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 65 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 66 if err != nil { 67 return nil, err 68 } 69 httpRequest.Header.Set("Authorization", authorization) 70 71 client := &http.Client{} 72 httpResponse, err := client.Do(httpRequest) 73 if err != nil { 74 return nil, err 75 } 76 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 77 if err != nil { 78 return nil, err 79 } 80 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 81 // 2XX 成功,验证应答签名 82 err = wxpay_utility.ValidateResponse( 83 config.WechatPayPublicKeyId(), 84 config.WechatPayPublicKey(), 85 &httpResponse.Header, 86 respBody, 87 ) 88 if err != nil { 89 return nil, err 90 } 91 response := &ProductCouponEntity{} 92 if err := json.Unmarshal(respBody, response); err != nil { 93 return nil, err 94 } 95 96 return response, nil 97 } else { 98 return nil, wxpay_utility.NewApiException( 99 httpResponse.StatusCode, 100 httpResponse.Header, 101 respBody, 102 ) 103 } 104} 105 106type GetProductCouponRequest struct { 107 ProductCouponId *string `json:"product_coupon_id,omitempty"` 108 BrandId *string `json:"brand_id,omitempty"` 109} 110 111func (o *GetProductCouponRequest) MarshalJSON() ([]byte, error) { 112 type Alias GetProductCouponRequest 113 a := &struct { 114 ProductCouponId *string `json:"product_coupon_id,omitempty"` 115 BrandId *string `json:"brand_id,omitempty"` 116 *Alias 117 }{ 118 // 序列化时移除非 Body 字段 119 ProductCouponId: nil, 120 BrandId: nil, 121 Alias: (*Alias)(o), 122 } 123 return json.Marshal(a) 124} 125 126type ProductCouponEntity struct { 127 ProductCouponId *string `json:"product_coupon_id,omitempty"` 128 Scope *ProductCouponScope `json:"scope,omitempty"` 129 Type *ProductCouponType `json:"type,omitempty"` 130 UsageMode *UsageMode `json:"usage_mode,omitempty"` 131 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"` 132 SequentialUsageInfo *SequentialUsageInfo `json:"sequential_usage_info,omitempty"` 133 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"` 134 OutProductNo *string `json:"out_product_no,omitempty"` 135 State *ProductCouponState `json:"state,omitempty"` 136 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"` 137 DeactivateTime *string `json:"deactivate_time,omitempty"` 138 DeactivateReason *string `json:"deactivate_reason,omitempty"` 139 BrandId *string `json:"brand_id,omitempty"` 140} 141 142type ProductCouponScope string 143 144func (e ProductCouponScope) Ptr() *ProductCouponScope { 145 return &e 146} 147 148const ( 149 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL" 150 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE" 151) 152 153type ProductCouponType string 154 155func (e ProductCouponType) Ptr() *ProductCouponType { 156 return &e 157} 158 159const ( 160 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL" 161 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT" 162 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE" 163) 164 165type UsageMode string 166 167func (e UsageMode) Ptr() *UsageMode { 168 return &e 169} 170 171const ( 172 USAGEMODE_SINGLE UsageMode = "SINGLE" 173 USAGEMODE_SEQUENTIAL UsageMode = "SEQUENTIAL" 174) 175 176type SingleUsageInfo struct { 177 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"` 178 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"` 179} 180 181type SequentialUsageInfo struct { 182 Type *SequentialUsageType `json:"type,omitempty"` 183 Count *int64 `json:"count,omitempty"` 184 AvailableDays *int64 `json:"available_days,omitempty"` 185 IntervalDays *int64 `json:"interval_days,omitempty"` 186} 187 188type ProductCouponDisplayInfo struct { 189 Name *string `json:"name,omitempty"` 190 ImageUrl *string `json:"image_url,omitempty"` 191 BackgroundUrl *string `json:"background_url,omitempty"` 192 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"` 193 OriginalPrice *int64 `json:"original_price,omitempty"` 194 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"` 195} 196 197type ProductCouponState string 198 199func (e ProductCouponState) Ptr() *ProductCouponState { 200 return &e 201} 202 203const ( 204 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING" 205 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE" 206 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED" 207) 208 209type NormalCouponUsageRule struct { 210 Threshold *int64 `json:"threshold,omitempty"` 211 DiscountAmount *int64 `json:"discount_amount,omitempty"` 212} 213 214type DiscountCouponUsageRule struct { 215 Threshold *int64 `json:"threshold,omitempty"` 216 PercentOff *int64 `json:"percent_off,omitempty"` 217} 218 219type SequentialUsageType string 220 221func (e SequentialUsageType) Ptr() *SequentialUsageType { 222 return &e 223} 224 225const ( 226 SEQUENTIALUSAGETYPE_INCREMENTAL SequentialUsageType = "INCREMENTAL" 227 SEQUENTIALUSAGETYPE_EQUAL SequentialUsageType = "EQUAL" 228) 229 230type ComboPackage struct { 231 Name *string `json:"name,omitempty"` 232 PickCount *int64 `json:"pick_count,omitempty"` 233 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"` 234} 235 236type ComboPackageChoice struct { 237 Name *string `json:"name,omitempty"` 238 Price *int64 `json:"price,omitempty"` 239 Count *int64 `json:"count,omitempty"` 240 ImageUrl *string `json:"image_url,omitempty"` 241 MiniProgramAppid *string `json:"mini_program_appid,omitempty"` 242 MiniProgramPath *string `json:"mini_program_path,omitempty"` 243} 244
应答参数
200 OK
product_coupon_id 必填 string(40)
【商品券ID】 商品券的唯一标识,由微信支付生成
scope 必填 string
【优惠范围】 商品券优惠范围
可选取值
ALL
: 全场券,此时券类型type
仅可配置为NORMAL
或DISCOUNT
SINGLE
: 单品券,此时券类型type
配置不受限制,即可配置为NORMAL
、DISCOUNT
或EXCHANGE
type 必填 string
【商品券类型】 商品券的优惠类型
可选取值
NORMAL
: 满减券DISCOUNT
: 折扣券EXCHANGE
: 换购券,仅在scope
为SINGLE
时可配置
usage_mode 必填 string
【使用模式】 商品券使用模式
可选取值
SINGLE
: 单券,即用户只能使用一次,使用后券失效SEQUENTIAL
: 多次优惠,即用户可以按顺序多次使用,每次核销成功后会发放下一次优惠机会,直到用完为止
single_usage_info 选填 object
【单券模式信息】 单券模式配置信息,当且仅当 usage_mode
为 SINGLE
时提供,其他场景不提供。
属性 | |||||||||
normal_coupon 选填 object 【满减券使用规则】 本商品券内所有批次均以此规则提供满减优惠,当且仅当
discount_coupon 选填 object 【折扣券使用规则】 本商品券内所有批次均以此规则提供折扣优惠,当且仅当
|
sequential_usage_info 选填 object
【多次优惠模式信息】 多次优惠模式配置信息,当且仅当 usage_mode
为 SEQUENTIAL
时提供,其他模式不提供。
属性 | |
type 必填 string 【多次优惠规则类型】 多次优惠规则类型 可选取值
count 必填 integer 【可使用次数】 本多次优惠领取后用户可使用次数,最多15次 available_days 必填 integer 【多次优惠有效天数】 用户的多次优惠生效后 N 天内有效,最少3天,最多365天 interval_days 选填 integer 【多次优惠使用间隔天数】 多次优惠多次使用之间需要间隔的天数,最高7天。例如:
默认情况下为 |
display_info 必填 object
【展示信息】 商品券展示信息
属性 | |||||||||
name 必填 string(15) 【商品券名称】 商品券名称,长度不超过15个UTF-8字符 image_url 必填 string 【商品券图片】 商品图片的链接地址,仅支持通过图片上传接口获取的图片URL地址。
background_url 必填 string 【商品券背景图】 商品背景图片的URL地址,仅支持通过图片上传接口获取的图片URL地址。
detail_image_url_list 选填 array[string] 【商品券详情图列表】 商品详情图URL地址列表,用于最多可上传8张图片,仅支持通过图片上传接口获取的图片URL地址。
original_price 选填 integer 【商品原价】 单位为分,当且仅当 combo_package_list 选填 array[object] 【套餐组合】 当
|
out_product_no 选填 string
【外部商品ID】 商户创建商品券时主动传入的外部商品ID,原样返回
state 必填 string
【商品券状态】 商品券状态
可选取值
AUDITING
: 审批中,审批完成前商品券不可用EFFECTIVE
: 生效中,商品券已生效,可以正常使用DEACTIVATED
: 已失效,品牌方主动调用失效接口使商品券失效
deactivate_request_no 选填 string
【失效请求单号】 当且仅当 state
为 DEACTIVATED
时提供,返回品牌方调用失效接口时传入的请求流水号
deactivate_time 选填 string
【失效时间】 当且仅当 state
为 DEACTIVATED
时提供,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
deactivate_reason 选填 string
【失效原因】 当且仅当 state
为 DEACTIVATED
时提供,返回品牌方调用失效商品券接口时传入的失效原因
brand_id 必填 string
【品牌ID】 微信支付为品牌方分配的唯一标识,该品牌应与服务商存在授权关系
应答示例
200 OK
1{ 2 "product_coupon_id" : "1002323", 3 "scope" : "ALL", 4 "type" : "NORMAL", 5 "usage_mode" : "SEQUENTIAL", 6 "single_usage_info" : { 7 "normal_coupon" : { 8 "threshold" : 10000, 9 "discount_amount" : 100 10 }, 11 "discount_coupon" : { 12 "threshold" : 10000, 13 "percent_off" : 30 14 } 15 }, 16 "sequential_usage_info" : { 17 "type" : "EQUAL", 18 "count" : 10, 19 "available_days" : 10, 20 "interval_days" : 1 21 }, 22 "display_info" : { 23 "name" : "全场满100可减10元", 24 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 25 "background_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 26 "detail_image_url_list" : [ 27 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 28 ], 29 "original_price" : 10000, 30 "combo_package_list" : [ 31 { 32 "name" : "咖啡2选1", 33 "pick_count" : 3, 34 "choice_list" : [ 35 { 36 "name" : "美式", 37 "price" : 10000, 38 "count" : 2, 39 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 40 "mini_program_appid" : "wx4fd12345678", 41 "mini_program_path" : "/pages/index/index" 42 } 43 ] 44 } 45 ] 46 }, 47 "out_product_no" : "Product_1234567890", 48 "state" : "AUDITING", 49 "deactivate_request_no" : "1002600620019090123143254436", 50 "deactivate_time" : "2025-06-20T13:29:35+08:00", 51 "deactivate_reason" : "商品已下架", 52 "brand_id" : "120344" 53} 54
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
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 | 请求超过接口频率限制 | 请稍后使用原参数重试 |