修改商品券
更新时间:2025.11.06品牌方可以通过该接口修改商品券信息。
注意: 修改只会对新发的券生效,历史已经发放给用户的券不会改变。
前置条件:商品券处于 EFFECTIVE 状态
频率限制:20/s
接口说明
支持商户:【品牌商户】
请求方式:【PATCH】/brand/marketing/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
Content-Type 必填 string
请设置为application/json
Wechatpay-Serial 必填 string
【微信支付公钥ID】 请传入brand_id对应的微信支付公钥ID,接口将会校验两者的关联关系,参考微信支付公钥产品简介及使用说明获取微信支付公钥ID和相关的介绍。以下两种场景将使用到微信支付公钥: 1、接收到接口的返回内容,需要使用微信支付公钥进行验签; 2、调用含有敏感信息参数(如姓名、身份证号码)的接口时,需要使用微信支付公钥加密敏感信息后再传输参数,加密指引请参考微信支付公钥加密敏感信息指引。
path 路径参数
product_coupon_id 必填 string
【商品券ID】 商品券的唯一标识,创建商品券时由微信支付生成
body 包体参数
out_request_no 必填 string(40)
【修改请求单号】 品牌修改商品券的请求流水号,品牌侧需保持唯一性,可使用 数字、大小写字母、下划线_、短横线- 组成,长度在6-40个字符之间
display_info 必填 object
【展示信息】 商品券展示信息
| 属性 | |||||||||
name 必填 string(15) 【商品券名称】 商品券名称,长度为3-15个UTF-8字符 image_url 必填 string 【商品券图片】 商品图片的链接地址,仅支持通过【图片上传API】获取的图片URL地址。
background_url 必填 string 【商品券背景图】 商品背景图片的URL地址,仅支持通过【图片上传API】获取的图片URL地址。
detail_image_url_list 选填 array[string] 【商品券详情图列表】 商品详情图URL地址列表,用于最多可上传8张图片,仅支持通过【图片上传API】获取的图片URL地址。
original_price 选填 integer 【商品原价】 单位为分,当且仅当 combo_package_list 选填 array[object] 【套餐组合】 当
|
请求示例
PATCH
调整商品券标题
1curl -X PATCH \ 2 https://api.mch.weixin.qq.com/brand/marketing/product-coupon/product-coupons/1000000013 \ 3 -H "Authorization: WECHATPAY-BRAND-SHA256-RSA2048 brand_id=\"XXXX\",..." \ 4 -H "Accept: application/json" \ 5 -H "Wechatpay-Serial: PUB_KEY_ID_XXXX" \ 6 -H "Content-Type: application/json" \ 7 -d '{ 8 "display_info" : { 9 "name" : "全场满100立打8折-新名字", 10 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 11 "background_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 12 "detail_image_url_list" : [ 13 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 14 ] 15 }, 16 "out_request_no" : "12345_20250101_A3489" 17 }' 18
需配合微信支付工具库 WXPayUtility 使用,请参考Java
1package com.java.demo; 2 3import com.java.utils.WXPayBrandUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/brand/4015826861 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 UpdateProductCoupon { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "PATCH"; 28 private static String PATH = "/brand/marketing/product-coupon/product-coupons/{product_coupon_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 32 UpdateProductCoupon client = new UpdateProductCoupon( 33 "xxxxxxxx", // 品牌ID,是由微信支付系统生成并分配给每个品牌方的唯一标识符,品牌ID获取方式参考 https://pay.weixin.qq.com/doc/brand/4015415289 34 "1DDE55AD98Exxxxxxxxxx", // 品牌API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015407570 35 "/path/to/apiclient_key.pem", // 品牌API证书私钥文件路径,本地文件路径 36 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015453439 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 UpdateProductCouponRequest request = new UpdateProductCouponRequest(); 41 request.outRequestNo = "12345_20250101_A3489"; 42 request.productCouponId = "1000000013"; 43 request.displayInfo = new ProductCouponDisplayInfo(); 44 request.displayInfo.name = "全场满100立打8折-新名字"; 45 request.displayInfo.imageUrl = "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"; 46 request.displayInfo.backgroundUrl = "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"; 47 request.displayInfo.detailImageUrlList = new ArrayList<>(); 48 { 49 request.displayInfo.detailImageUrlList.add("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"); 50 }; 51 try { 52 ProductCouponEntity response = client.run(request); 53 // TODO: 请求成功,继续业务逻辑 54 System.out.println(response); 55 } catch (WXPayBrandUtility.ApiException e) { 56 // TODO: 请求失败,根据状态码执行不同的逻辑 57 e.printStackTrace(); 58 } 59 } 60 61 public ProductCouponEntity run(UpdateProductCouponRequest request) { 62 String uri = PATH; 63 uri = uri.replace("{product_coupon_id}", WXPayBrandUtility.urlEncode(request.productCouponId)); 64 String reqBody = WXPayBrandUtility.toJson(request); 65 66 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 67 reqBuilder.addHeader("Accept", "application/json"); 68 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 69 reqBuilder.addHeader("Authorization", WXPayBrandUtility.buildAuthorization(brand_id, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 70 reqBuilder.addHeader("Content-Type", "application/json"); 71 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 72 reqBuilder.method(METHOD, requestBody); 73 Request httpRequest = reqBuilder.build(); 74 75 // 发送HTTP请求 76 OkHttpClient client = new OkHttpClient.Builder().build(); 77 try (Response httpResponse = client.newCall(httpRequest).execute()) { 78 String respBody = WXPayBrandUtility.extractBody(httpResponse); 79 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 80 // 2XX 成功,验证应答签名 81 WXPayBrandUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 82 httpResponse.headers(), respBody); 83 84 // 从HTTP应答报文构建返回数据 85 return WXPayBrandUtility.fromJson(respBody, ProductCouponEntity.class); 86 } else { 87 throw new WXPayBrandUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 88 } 89 } catch (IOException e) { 90 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 91 } 92 } 93 94 private final String brand_id; 95 private final String certificateSerialNo; 96 private final PrivateKey privateKey; 97 private final String wechatPayPublicKeyId; 98 private final PublicKey wechatPayPublicKey; 99 100 public UpdateProductCoupon(String brand_id, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 101 this.brand_id = brand_id; 102 this.certificateSerialNo = certificateSerialNo; 103 this.privateKey = WXPayBrandUtility.loadPrivateKeyFromPath(privateKeyFilePath); 104 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 105 this.wechatPayPublicKey = WXPayBrandUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 106 } 107 108 public static class UpdateProductCouponRequest { 109 @SerializedName("out_request_no") 110 public String outRequestNo; 111 112 @SerializedName("product_coupon_id") 113 @Expose(serialize = false) 114 public String productCouponId; 115 116 @SerializedName("display_info") 117 public ProductCouponDisplayInfo displayInfo; 118 } 119 120 public static class ProductCouponEntity { 121 @SerializedName("product_coupon_id") 122 public String productCouponId; 123 124 @SerializedName("scope") 125 public ProductCouponScope scope; 126 127 @SerializedName("type") 128 public ProductCouponType type; 129 130 @SerializedName("usage_mode") 131 public UsageMode usageMode; 132 133 @SerializedName("single_usage_info") 134 public SingleUsageInfo singleUsageInfo; 135 136 @SerializedName("progressive_bundle_usage_info") 137 public ProgressiveBundleUsageInfo progressiveBundleUsageInfo; 138 139 @SerializedName("display_info") 140 public ProductCouponDisplayInfo displayInfo; 141 142 @SerializedName("out_product_no") 143 public String outProductNo; 144 145 @SerializedName("state") 146 public ProductCouponState state; 147 148 @SerializedName("deactivate_request_no") 149 public String deactivateRequestNo; 150 151 @SerializedName("deactivate_time") 152 public String deactivateTime; 153 154 @SerializedName("deactivate_reason") 155 public String deactivateReason; 156 } 157 158 public static class ProductCouponDisplayInfo { 159 @SerializedName("name") 160 public String name; 161 162 @SerializedName("image_url") 163 public String imageUrl; 164 165 @SerializedName("background_url") 166 public String backgroundUrl; 167 168 @SerializedName("detail_image_url_list") 169 public List<String> detailImageUrlList; 170 171 @SerializedName("original_price") 172 public Long originalPrice; 173 174 @SerializedName("combo_package_list") 175 public List<ComboPackage> comboPackageList; 176 } 177 178 public enum ProductCouponScope { 179 @SerializedName("ALL") 180 ALL, 181 @SerializedName("SINGLE") 182 SINGLE 183 } 184 185 public enum ProductCouponType { 186 @SerializedName("NORMAL") 187 NORMAL, 188 @SerializedName("DISCOUNT") 189 DISCOUNT, 190 @SerializedName("EXCHANGE") 191 EXCHANGE 192 } 193 194 public enum UsageMode { 195 @SerializedName("SINGLE") 196 SINGLE, 197 @SerializedName("PROGRESSIVE_BUNDLE") 198 PROGRESSIVE_BUNDLE 199 } 200 201 public static class SingleUsageInfo { 202 @SerializedName("normal_coupon") 203 public NormalCouponUsageRule normalCoupon; 204 205 @SerializedName("discount_coupon") 206 public DiscountCouponUsageRule discountCoupon; 207 } 208 209 public static class ProgressiveBundleUsageInfo { 210 @SerializedName("count") 211 public Long count; 212 213 @SerializedName("interval_days") 214 public Long intervalDays; 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 ComboPackage { 227 @SerializedName("name") 228 public String name; 229 230 @SerializedName("pick_count") 231 public Long pickCount; 232 233 @SerializedName("choice_list") 234 public List<ComboPackageChoice> choiceList = new ArrayList<ComboPackageChoice>(); 235 } 236 237 public static class NormalCouponUsageRule { 238 @SerializedName("threshold") 239 public Long threshold; 240 241 @SerializedName("discount_amount") 242 public Long discountAmount; 243 } 244 245 public static class DiscountCouponUsageRule { 246 @SerializedName("threshold") 247 public Long threshold; 248 249 @SerializedName("percent_off") 250 public Long percentOff; 251 } 252 253 public static class ComboPackageChoice { 254 @SerializedName("name") 255 public String name; 256 257 @SerializedName("price") 258 public Long price; 259 260 @SerializedName("count") 261 public Long count; 262 263 @SerializedName("image_url") 264 public String imageUrl; 265 266 @SerializedName("mini_program_appid") 267 public String miniProgramAppid; 268 269 @SerializedName("mini_program_path") 270 public String miniProgramPath; 271 } 272 273} 274
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "bytes" 5 "demo/wxpay_brand_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/brand/4015826866 6 "encoding/json" 7 "fmt" 8 "net/http" 9 "net/url" 10 "strings" 11) 12 13func main() { 14 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 15 config, err := wxpay_brand_utility.CreateBrandConfig( 16 "xxxxxxxx", // 品牌ID,是由微信支付系统生成并分配给每个品牌方的唯一标识符,品牌ID获取方式参考 https://pay.weixin.qq.com/doc/brand/4015415289 17 "1DDE55AD98Exxxxxxxxxx", // 品牌API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015407570 18 "/path/to/apiclient_key.pem", // 品牌API证书私钥文件路径,本地文件路径 19 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015453439 20 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 21 ) 22 if err != nil { 23 fmt.Println(err) 24 return 25 } 26 27 request := &UpdateProductCouponRequest{ 28 OutRequestNo: wxpay_brand_utility.String("12345_20250101_A3489"), 29 ProductCouponId: wxpay_brand_utility.String("1000000013"), 30 DisplayInfo: &ProductCouponDisplayInfo{ 31 Name: wxpay_brand_utility.String("全场满100立打8折-新名字"), 32 ImageUrl: wxpay_brand_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"), 33 BackgroundUrl: wxpay_brand_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"), 34 DetailImageUrlList: []string{ 35 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 36 }, 37 }, 38 } 39 40 response, err := UpdateProductCoupon(config, request) 41 if err != nil { 42 fmt.Printf("请求失败: %+v\n", err) 43 // TODO: 请求失败,根据状态码执行不同的处理 44 return 45 } 46 47 // TODO: 请求成功,继续业务逻辑 48 fmt.Printf("请求成功: %+v\n", response) 49} 50 51func UpdateProductCoupon(config *wxpay_brand_utility.BrandConfig, request *UpdateProductCouponRequest) (response *ProductCouponEntity, err error) { 52 const ( 53 host = "https://api.mch.weixin.qq.com" 54 method = "PATCH" 55 path = "/brand/marketing/product-coupon/product-coupons/{product_coupon_id}" 56 ) 57 58 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 59 if err != nil { 60 return nil, err 61 } 62 reqUrl.Path = strings.Replace(reqUrl.Path, "{product_coupon_id}", url.PathEscape(*request.ProductCouponId), -1) 63 reqBody, err := json.Marshal(request) 64 if err != nil { 65 return nil, err 66 } 67 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 68 if err != nil { 69 return nil, err 70 } 71 httpRequest.Header.Set("Accept", "application/json") 72 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 73 httpRequest.Header.Set("Content-Type", "application/json") 74 authorization, err := wxpay_brand_utility.BuildAuthorization(config.BrandId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 75 if err != nil { 76 return nil, err 77 } 78 httpRequest.Header.Set("Authorization", authorization) 79 80 client := &http.Client{} 81 httpResponse, err := client.Do(httpRequest) 82 if err != nil { 83 return nil, err 84 } 85 respBody, err := wxpay_brand_utility.ExtractResponseBody(httpResponse) 86 if err != nil { 87 return nil, err 88 } 89 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 90 // 2XX 成功,验证应答签名 91 err = wxpay_brand_utility.ValidateResponse( 92 config.WechatPayPublicKeyId(), 93 config.WechatPayPublicKey(), 94 &httpResponse.Header, 95 respBody, 96 ) 97 if err != nil { 98 return nil, err 99 } 100 response := &ProductCouponEntity{} 101 if err := json.Unmarshal(respBody, response); err != nil { 102 return nil, err 103 } 104 105 return response, nil 106 } else { 107 return nil, wxpay_brand_utility.NewApiException( 108 httpResponse.StatusCode, 109 httpResponse.Header, 110 respBody, 111 ) 112 } 113} 114 115type UpdateProductCouponRequest struct { 116 OutRequestNo *string `json:"out_request_no,omitempty"` 117 ProductCouponId *string `json:"product_coupon_id,omitempty"` 118 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"` 119} 120 121func (o *UpdateProductCouponRequest) MarshalJSON() ([]byte, error) { 122 type Alias UpdateProductCouponRequest 123 a := &struct { 124 ProductCouponId *string `json:"product_coupon_id,omitempty"` 125 *Alias 126 }{ 127 // 序列化时移除非 Body 字段 128 ProductCouponId: nil, 129 Alias: (*Alias)(o), 130 } 131 return json.Marshal(a) 132} 133 134type ProductCouponEntity struct { 135 ProductCouponId *string `json:"product_coupon_id,omitempty"` 136 Scope *ProductCouponScope `json:"scope,omitempty"` 137 Type *ProductCouponType `json:"type,omitempty"` 138 UsageMode *UsageMode `json:"usage_mode,omitempty"` 139 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"` 140 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"` 141 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"` 142 OutProductNo *string `json:"out_product_no,omitempty"` 143 State *ProductCouponState `json:"state,omitempty"` 144 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"` 145 DeactivateTime *string `json:"deactivate_time,omitempty"` 146 DeactivateReason *string `json:"deactivate_reason,omitempty"` 147} 148 149type ProductCouponDisplayInfo struct { 150 Name *string `json:"name,omitempty"` 151 ImageUrl *string `json:"image_url,omitempty"` 152 BackgroundUrl *string `json:"background_url,omitempty"` 153 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"` 154 OriginalPrice *int64 `json:"original_price,omitempty"` 155 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"` 156} 157 158type ProductCouponScope string 159 160func (e ProductCouponScope) Ptr() *ProductCouponScope { 161 return &e 162} 163 164const ( 165 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL" 166 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE" 167) 168 169type ProductCouponType string 170 171func (e ProductCouponType) Ptr() *ProductCouponType { 172 return &e 173} 174 175const ( 176 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL" 177 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT" 178 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE" 179) 180 181type UsageMode string 182 183func (e UsageMode) Ptr() *UsageMode { 184 return &e 185} 186 187const ( 188 USAGEMODE_SINGLE UsageMode = "SINGLE" 189 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE" 190) 191 192type SingleUsageInfo struct { 193 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"` 194 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"` 195} 196 197type ProgressiveBundleUsageInfo struct { 198 Count *int64 `json:"count,omitempty"` 199 IntervalDays *int64 `json:"interval_days,omitempty"` 200} 201 202type ProductCouponState string 203 204func (e ProductCouponState) Ptr() *ProductCouponState { 205 return &e 206} 207 208const ( 209 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING" 210 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE" 211 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED" 212) 213 214type ComboPackage struct { 215 Name *string `json:"name,omitempty"` 216 PickCount *int64 `json:"pick_count,omitempty"` 217 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"` 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 ComboPackageChoice struct { 231 Name *string `json:"name,omitempty"` 232 Price *int64 `json:"price,omitempty"` 233 Count *int64 `json:"count,omitempty"` 234 ImageUrl *string `json:"image_url,omitempty"` 235 MiniProgramAppid *string `json:"mini_program_appid,omitempty"` 236 MiniProgramPath *string `json:"mini_program_path,omitempty"` 237} 238
应答参数
200 OK
product_coupon_id 必填 string(40)
【商品券ID】 商品券的唯一标识,由微信支付生成
scope 必填 string
【优惠范围】 商品券优惠范围
可选取值
ALL: 全场券,此时券类型type仅可配置为NORMAL或DISCOUNTSINGLE: 单品券,此时券类型type配置不受限制,即可配置为NORMAL、DISCOUNT或EXCHANGE
type 必填 string
【商品券类型】 商品券的优惠类型
可选取值
NORMAL: 满减券DISCOUNT: 折扣券EXCHANGE: 兑换券,仅在scope为SINGLE时可配置
usage_mode 必填 string
【使用模式】 商品券使用模式
可选取值
SINGLE: 单券,即用户只能使用一次,使用后券失效PROGRESSIVE_BUNDLE: 多次优惠,由一组批次组成,每阶梯次序对应一个批次。用户按顺序使用,每次核销后发放下一张券,直到用完为止
single_usage_info 选填 object
【单券模式信息】 单券模式配置信息,仅当 usage_mode 为 SINGLE 时提供,其他场景不提供。
| 属性 | |||||||||
normal_coupon 选填 object 【满减券使用规则】 本商品券内所有批次均以此规则提供满减优惠,当且仅当
discount_coupon 选填 object 【折扣券使用规则】 本商品券内所有批次均以此规则提供折扣优惠,当且仅当
|
progressive_bundle_usage_info 选填 object
【多次优惠模式信息】 多次优惠模式配置信息,当且仅当 usage_mode 为 PROGRESSIVE_BUNDLE 时提供,其他模式不提供。
| 属性 | |
count 必填 integer 【可使用次数】 多次优惠领取后用户可使用次数,最少3次,最多15次 interval_days 选填 integer 【多次优惠使用间隔天数】 多次优惠多次使用之间需要间隔的天数,最高7天。例如:
默认情况下为 |
display_info 必填 object
【展示信息】 商品券展示信息
| 属性 | |||||||||
name 必填 string(15) 【商品券名称】 商品券名称,长度为3-15个UTF-8字符 image_url 必填 string 【商品券图片】 商品图片的链接地址,仅支持通过【图片上传API】获取的图片URL地址。
background_url 必填 string 【商品券背景图】 商品背景图片的URL地址,仅支持通过【图片上传API】获取的图片URL地址。
detail_image_url_list 选填 array[string] 【商品券详情图列表】 商品详情图URL地址列表,用于最多可上传8张图片,仅支持通过【图片上传API】获取的图片URL地址。
original_price 选填 integer 【商品原价】 单位为分,当且仅当 combo_package_list 选填 array[object] 【套餐组合】 当
|
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】时传入的失效原因
应答示例
200 OK
调整商品券标题
1{ 2 "product_coupon_id" : "1000000013", 3 "scope" : "ALL", 4 "type" : "DISCOUNT", 5 "usage_mode" : "SINGLE", 6 "single_usage_info" : { 7 "discount_coupon" : { 8 "threshold" : 10000, 9 "percent_off" : 20 10 } 11 }, 12 "display_info" : { 13 "name" : "全场满100立打8折-新名字", 14 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 15 "background_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 16 "detail_image_url_list" : [ 17 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 18 ] 19 }, 20 "state" : "EFFECTIVE", 21 "out_product_no" : "Product_1234567890" 22} 23
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示
状态码 | 错误码 | 描述 | 解决方案 |
|---|---|---|---|
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 | 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 |

