查询商品券
更新时间:2025.08.20服务商可以通过该接口查询商品券的详细信息,但不包括商品券的批次信息。
如果要查询商品券的批次列表,请使用【查询商品券批次列表API】
前置条件:已创建商品券
接口说明
支持商户:【普通服务商】
请求方式:【GET】/v3/marketing/partner/product-coupon/product-coupons/{product_coupon_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
接口限频:20/秒(商户号维度)
请求参数
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/1000000013?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 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 GetProductCouponRequest request = new GetProductCouponRequest(); 41 request.productCouponId = "1000000013"; 42 request.brandId = "120344"; 43 try { 44 ProductCouponEntity response = client.run(request); 45 // TODO: 请求成功,继续业务逻辑 46 System.out.println(response); 47 } catch (WXPayUtility.ApiException e) { 48 // TODO: 请求失败,根据状态码执行不同的逻辑 49 e.printStackTrace(); 50 } 51 } 52 53 public ProductCouponEntity run(GetProductCouponRequest request) { 54 String uri = PATH; 55 uri = uri.replace("{product_coupon_id}", WXPayUtility.urlEncode(request.productCouponId)); 56 Map<String, Object> args = new HashMap<>(); 57 args.put("brand_id", request.brandId); 58 String queryString = WXPayUtility.urlEncode(args); 59 if (!queryString.isEmpty()) { 60 uri = uri + "?" + queryString; 61 } 62 63 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 64 reqBuilder.addHeader("Accept", "application/json"); 65 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 66 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 67 reqBuilder.method(METHOD, null); 68 Request httpRequest = reqBuilder.build(); 69 70 // 发送HTTP请求 71 OkHttpClient client = new OkHttpClient.Builder().build(); 72 try (Response httpResponse = client.newCall(httpRequest).execute()) { 73 String respBody = WXPayUtility.extractBody(httpResponse); 74 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 75 // 2XX 成功,验证应答签名 76 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 77 httpResponse.headers(), respBody); 78 79 // 从HTTP应答报文构建返回数据 80 return WXPayUtility.fromJson(respBody, ProductCouponEntity.class); 81 } else { 82 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 83 } 84 } catch (IOException e) { 85 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 86 } 87 } 88 89 private final String mchid; 90 private final String certificateSerialNo; 91 private final PrivateKey privateKey; 92 private final String wechatPayPublicKeyId; 93 private final PublicKey wechatPayPublicKey; 94 95 public GetProductCoupon(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 96 this.mchid = mchid; 97 this.certificateSerialNo = certificateSerialNo; 98 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 99 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 100 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 101 } 102 103 public static class GetProductCouponRequest { 104 @SerializedName("product_coupon_id") 105 @Expose(serialize = false) 106 public String productCouponId; 107 108 @SerializedName("brand_id") 109 @Expose(serialize = false) 110 public String brandId; 111 } 112 113 public static class ProductCouponEntity { 114 @SerializedName("product_coupon_id") 115 public String productCouponId; 116 117 @SerializedName("scope") 118 public ProductCouponScope scope; 119 120 @SerializedName("type") 121 public ProductCouponType type; 122 123 @SerializedName("usage_mode") 124 public UsageMode usageMode; 125 126 @SerializedName("single_usage_info") 127 public SingleUsageInfo singleUsageInfo; 128 129 @SerializedName("progressive_bundle_usage_info") 130 public ProgressiveBundleUsageInfo progressiveBundleUsageInfo; 131 132 @SerializedName("display_info") 133 public ProductCouponDisplayInfo displayInfo; 134 135 @SerializedName("out_product_no") 136 public String outProductNo; 137 138 @SerializedName("state") 139 public ProductCouponState state; 140 141 @SerializedName("deactivate_request_no") 142 public String deactivateRequestNo; 143 144 @SerializedName("deactivate_time") 145 public String deactivateTime; 146 147 @SerializedName("deactivate_reason") 148 public String deactivateReason; 149 150 @SerializedName("brand_id") 151 public String brandId; 152 153 @SerializedName("available_product_no_list") 154 public List<String> availableProductNoList; 155 156 @SerializedName("business_mode") 157 public ProductCouponBusinessMode businessMode; 158 } 159 160 public enum ProductCouponScope { 161 @SerializedName("ALL") 162 ALL, 163 @SerializedName("SINGLE") 164 SINGLE, 165 @SerializedName("CATEGORY") 166 CATEGORY 167 } 168 169 public enum ProductCouponType { 170 @SerializedName("NORMAL") 171 NORMAL, 172 @SerializedName("DISCOUNT") 173 DISCOUNT, 174 @SerializedName("EXCHANGE") 175 EXCHANGE 176 } 177 178 public enum UsageMode { 179 @SerializedName("SINGLE") 180 SINGLE, 181 @SerializedName("PROGRESSIVE_BUNDLE") 182 PROGRESSIVE_BUNDLE 183 } 184 185 public static class SingleUsageInfo { 186 @SerializedName("normal_coupon") 187 public NormalCouponUsageRule normalCoupon; 188 189 @SerializedName("discount_coupon") 190 public DiscountCouponUsageRule discountCoupon; 191 } 192 193 public static class ProgressiveBundleUsageInfo { 194 @SerializedName("count") 195 public Long count; 196 197 @SerializedName("interval_days") 198 public Long intervalDays; 199 } 200 201 public static class ProductCouponDisplayInfo { 202 @SerializedName("name") 203 public String name; 204 205 @SerializedName("image_url") 206 public String imageUrl; 207 208 @SerializedName("background_url") 209 public String backgroundUrl; 210 211 @SerializedName("detail_image_url_list") 212 public List<String> detailImageUrlList; 213 214 @SerializedName("original_price") 215 public Long originalPrice; 216 217 @SerializedName("combo_package_list") 218 public List<ComboPackage> comboPackageList; 219 } 220 221 public enum ProductCouponState { 222 @SerializedName("AUDITING") 223 AUDITING, 224 @SerializedName("EFFECTIVE") 225 EFFECTIVE, 226 @SerializedName("DEACTIVATED") 227 DEACTIVATED 228 } 229 230 public enum ProductCouponBusinessMode { 231 @SerializedName("FREE") 232 FREE 233 } 234 235 public static class NormalCouponUsageRule { 236 @SerializedName("threshold") 237 public Long threshold; 238 239 @SerializedName("discount_amount") 240 public Long discountAmount; 241 } 242 243 public static class DiscountCouponUsageRule { 244 @SerializedName("threshold") 245 public Long threshold; 246 247 @SerializedName("percent_off") 248 public Long percentOff; 249 } 250 251 public static class ComboPackage { 252 @SerializedName("name") 253 public String name; 254 255 @SerializedName("pick_count") 256 public Long pickCount; 257 258 @SerializedName("choice_list") 259 public List<ComboPackageChoice> choiceList = new ArrayList<ComboPackageChoice>(); 260 } 261 262 public static class ComboPackageChoice { 263 @SerializedName("name") 264 public String name; 265 266 @SerializedName("price") 267 public Long price; 268 269 @SerializedName("count") 270 public Long count; 271 272 @SerializedName("image_url") 273 public String imageUrl; 274 275 @SerializedName("mini_program_appid") 276 public String miniProgramAppid; 277 278 @SerializedName("mini_program_path") 279 public String miniProgramPath; 280 } 281 282} 283
需配合微信支付工具库 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("1000000013"), 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 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_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 AvailableProductNoList []string `json:"available_product_no_list,omitempty"` 141 BusinessMode *ProductCouponBusinessMode `json:"business_mode,omitempty"` 142} 143 144type ProductCouponScope string 145 146func (e ProductCouponScope) Ptr() *ProductCouponScope { 147 return &e 148} 149 150const ( 151 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL" 152 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE" 153 PRODUCTCOUPONSCOPE_CATEGORY ProductCouponScope = "CATEGORY" 154) 155 156type ProductCouponType string 157 158func (e ProductCouponType) Ptr() *ProductCouponType { 159 return &e 160} 161 162const ( 163 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL" 164 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT" 165 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE" 166) 167 168type UsageMode string 169 170func (e UsageMode) Ptr() *UsageMode { 171 return &e 172} 173 174const ( 175 USAGEMODE_SINGLE UsageMode = "SINGLE" 176 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE" 177) 178 179type SingleUsageInfo struct { 180 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"` 181 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"` 182} 183 184type ProgressiveBundleUsageInfo struct { 185 Count *int64 `json:"count,omitempty"` 186 IntervalDays *int64 `json:"interval_days,omitempty"` 187} 188 189type ProductCouponDisplayInfo struct { 190 Name *string `json:"name,omitempty"` 191 ImageUrl *string `json:"image_url,omitempty"` 192 BackgroundUrl *string `json:"background_url,omitempty"` 193 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"` 194 OriginalPrice *int64 `json:"original_price,omitempty"` 195 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"` 196} 197 198type ProductCouponState string 199 200func (e ProductCouponState) Ptr() *ProductCouponState { 201 return &e 202} 203 204const ( 205 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING" 206 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE" 207 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED" 208) 209 210type ProductCouponBusinessMode string 211 212func (e ProductCouponBusinessMode) Ptr() *ProductCouponBusinessMode { 213 return &e 214} 215 216const ( 217 PRODUCTCOUPONBUSINESSMODE_FREE ProductCouponBusinessMode = "FREE" 218) 219 220type NormalCouponUsageRule struct { 221 Threshold *int64 `json:"threshold,omitempty"` 222 DiscountAmount *int64 `json:"discount_amount,omitempty"` 223} 224 225type DiscountCouponUsageRule struct { 226 Threshold *int64 `json:"threshold,omitempty"` 227 PercentOff *int64 `json:"percent_off,omitempty"` 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或DISCOUNTSINGLE: 部分商品可用券,此时券类型type配置不受限制,即可配置为NORMAL、DISCOUNT或EXCHANGECATEGORY: 品类券。适用于商户对某一品类商品提供优惠的场景;系统侧不维护商品/品类清单,具体可用商品范围由商户在display_info描述、图片等字段中向用户告知,并在核销时由商户自行判定。此时券类型type仅可配置为NORMAL或DISCOUNT
type 必填 string
【商品券类型】 商品券的优惠类型
可选取值
NORMAL: 满减券DISCOUNT: 折扣券EXCHANGE: 兑换券,仅在scope为SINGLE时可配置
usage_mode 必填 string
【使用模式】 商品券使用模式
可选取值
SINGLE: 单券,即用户只能使用一次,使用后券失效PROGRESSIVE_BUNDLE: 多次优惠,由一组批次组成,每阶梯次序对应一个批次。用户按顺序使用,每次核销后发放下一张券,直到用完为止
single_usage_info 选填 object
【单券模式信息】 单券模式配置信息,仅当 usage_mode 为 SINGLE 时提供,其他场景不提供。
normal_coupon 选填 object
【满减券使用规则】 本商品券内所有批次均以此规则提供满减优惠,当且仅当 type 为 NORMAL 且 scope 为 ALL 或 CATEGORY 时必填,其他类型不应填写。
threshold 必填 integer
【门槛金额】 使用门槛金额,单位为分,达到该门槛后可享受满减优惠。门槛可以为0,0元和0.01元都为无门槛。例如:
满 100 元可用填
10000满 0.01 元可用填
1
discount_amount 必填 integer
【固定减免金额】 固定减免金额,单位为分,必须大于0。
discount_coupon 选填 object
【折扣券使用规则】 本商品券内所有批次均以此规则提供折扣优惠,当且仅当 type 为 DISCOUNT 且 scope 为 ALL 或 CATEGORY 时必填,其他类型不应填写。
threshold 必填 integer
【门槛金额】 使用门槛金额,单位为分,达到该门槛后可享受折扣优惠。门槛可以为0,0元和0.01元都为无门槛。例如:
满 100 元可用填
10000满 0.01 元可用填
1
percent_off 必填 integer
【固定减免百分比】 表示减免金额为总金额的百分比,必须大于0。例如:填入 30 表示减免 30%,即打 7 折
progressive_bundle_usage_info 选填 object
【多次优惠模式信息】 多次优惠模式配置信息,当且仅当 usage_mode 为 PROGRESSIVE_BUNDLE 时提供,其他模式不提供。
count 必填 integer
【可使用次数】 多次优惠领取后用户可使用次数,最少3次,最多15次
interval_days 选填 integer
【多次优惠使用间隔天数】 多次优惠多次使用之间需要间隔的天数,最高7天。例如:
间隔
0天表示不限制,使用后当天仍然可以继续使用下一次优惠间隔
1天表示使用后当天不再可用,下一次优惠需要等到次日 00:00:00 才能使用间隔
2天表示使用后当天和次日不再可用,下一次优惠需要等到第三天 00:00:00 才能使用依此类推……
默认情况下为 0 天,即不限制,使用后当天仍然可以继续使用下一次优惠
display_info 必填 object
【展示信息】 商品券展示信息
name 必填 string(25)
【商品券名称】 商品券名称,长度为3-25个UTF-8字符
image_url 必填 string
【商品券图片】 商品图片的链接地址,仅支持通过【图片上传API】获取的图片URL地址。
请参考商品券图片设计规范进行设计
要求图片宽高比1:1,建议尺寸1080*1080
大小不超过2M
建议图片格式:透明PNG格式
需要注意保留透明边距(上下左右各120px)
background_url 必填 string
【商品券背景图】 商品背景图片的URL地址,仅支持通过【图片上传API】获取的图片URL地址。
要求图片宽高比65:77,建议尺寸1170*1326
大小不超过2M
建议图片格式:JPG/PNG格式
需要注意保留「商品名称」与「商品图」的安全区域
detail_image_url_list 选填 array[string]
【商品券详情图列表】 商品详情图URL地址列表,用于最多可上传8张图片,仅支持通过【图片上传API】获取的图片URL地址。
要求图片宽高比65:77,建议尺寸1170*1326
大小不超过2M
建议图片格式:JPG/PNG格式
original_price 选填 integer
【商品原价】 单位为分,用于对外展示,最大为 10000000。不填写时默认为 0
combo_package_list 选填 array[object]
【适用商品组合】 当 scope 为 SINGLE 必填,用于对外展示,其他优惠范围选填。最多配置 50 个组合
name 必填 string(25)
【适用商品名】 长度不超过25个UTF-8字符
pick_count 必填 integer
【可选单品数量】 用户可以从 choice_list 中选择的选项数量,例如 10 选 3,则这里填 3
choice_list 必填 array[object]
【单品列表】 套餐内包含的选项列表,记录每个单品的信息,最多99个单品,且不能少于设置的pick_count数量
name 必填 string(25)
【单品名称】 长度不超过25个UTF-8字符
price 必填 integer
【单品价格】 单位为分,必须大于0。
count 必填 integer
【单品数量】 最多99个
image_url 选填 string
【单品图片】 单品图片URL地址,仅支持通过【图片上传API】获取的图片URL地址,接入领券组件和核销组件的品牌方建议填写。
要求图片宽高比1:1,建议尺寸1080*1080
大小不超过2M
建议图片格式:透明PNG格式
需要注意保留透明边距(上下左右各120px)
mini_program_appid 选填 string
【单品跳转小程序AppID】 品牌方或服务商可展示单品的小程序AppID,小程序需与品牌方或服务商存在绑定关系,接入领券组件和核销组件的品牌方或服务商建议填写。需和 mini_program_path 一同填写。
mini_program_path 选填 string
【单品跳转小程序路径】 单品展示信息在小程序内的跳转路径,接入领券组件和核销组件的品牌方或服务商建议填写。需和 mini_program_appid 一同填写。
out_product_no 选填 string
【外部商品ID】 商户创建商品券时主动传入的外部商品ID,原样返回
state 必填 string
【商品券状态】 商品券状态
可选取值
AUDITING: 审批中,审批完成前商品券不可用EFFECTIVE: 生效中,商品券已生效,可以正常使用DEACTIVATED: 已失效,品牌方主动调用失效接口使商品券失效
deactivate_request_no 选填 string(128)
【失效请求单号】 当且仅当 state 为 DEACTIVATED 时提供,返回品牌方调用【失效商品券API】时传入的请求流水号
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(150)
【失效原因】 当且仅当 state 为 DEACTIVATED 时提供,返回品牌方调用【失效商品券API】时传入的失效原因
brand_id 必填 string
【品牌ID】 微信支付为品牌方分配的唯一标识,该品牌应与服务商存在授权关系
available_product_no_list 选填 array[string]
【可用商品编码列表】 商户创建商品券时主动传入的可用商品编码,原样返回
business_mode 必填 string
【业务模式】 商品券的业务模式;本能力上线前创建的存量商品券统一返回 FREE
可选取值
FREE: 普通券,用户可直接领取。
应答示例
200 OK
查询商品券
1{ 2 "product_coupon_id" : "1000000013", 3 "scope" : "ALL", 4 "type" : "DISCOUNT", 5 "usage_mode" : "SINGLE", 6 "business_mode" : "FREE", 7 "single_usage_info" : { 8 "discount_coupon" : { 9 "threshold" : 10000, 10 "percent_off" : 20 11 } 12 }, 13 "display_info" : { 14 "name" : "全场满100立打8折-新名字", 15 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 16 "background_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 17 "detail_image_url_list" : [ 18 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 19 ] 20 }, 21 "state" : "EFFECTIVE", 22 "out_product_no" : "Product_1234567890", 23 "brand_id" : "120344" 24} 25
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示
