修改商品券
更新时间:2025.11.07服务商可以通过该接口修改商品券信息。
注意: 修改只会对新发的券生效,历史已经发放给用户的券不会改变。
前置条件:商品券处于 EFFECTIVE 状态
频率限制:20/s
接口说明
支持商户:【普通服务商】
请求方式:【PATCH】/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
Content-Type 必填 string
请设置为application/json
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 【商品券图片】 商品图片的链接地址,仅支持通过图片上传接口获取的图片URL地址。
background_url 必填 string 【商品券背景图】 商品背景图片的URL地址,仅支持通过图片上传接口获取的图片URL地址。
detail_image_url_list 选填 array[string] 【商品券详情图列表】 商品详情图URL地址列表,用于最多可上传8张图片,仅支持通过图片上传接口获取的图片URL地址。
original_price 选填 integer 【商品原价】 单位为分,当且仅当 combo_package_list 选填 array[object] 【套餐组合】 当
|
brand_id 必填 string
【品牌ID】 微信支付为品牌方分配的唯一标识,该品牌应与服务商存在授权关系
请求示例
PATCH
调整商品券标题
1curl -X PATCH \ 2 https://api.mch.weixin.qq.com/v3/marketing/partner/product-coupon/product-coupons/1000000013 \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Content-Type: application/json" \ 6 -d '{ 7 "display_info" : { 8 "name" : "全场满100立打8折-新名字", 9 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 10 "background_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 11 "detail_image_url_list" : [ 12 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 13 ] 14 }, 15 "out_request_no" : "12345_20250101_A3489", 16 "brand_id" : "120344" 17 }' 18
需配合微信支付工具库 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 UpdateProductCoupon { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "PATCH"; 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 UpdateProductCoupon client = new UpdateProductCoupon( 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 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 request.brandId = "120344"; 52 try { 53 ProductCouponEntity response = client.run(request); 54 // TODO: 请求成功,继续业务逻辑 55 System.out.println(response); 56 } catch (WXPayUtility.ApiException e) { 57 // TODO: 请求失败,根据状态码执行不同的逻辑 58 e.printStackTrace(); 59 } 60 } 61 62 public ProductCouponEntity run(UpdateProductCouponRequest request) { 63 String uri = PATH; 64 uri = uri.replace("{product_coupon_id}", WXPayUtility.urlEncode(request.productCouponId)); 65 String reqBody = WXPayUtility.toJson(request); 66 67 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 68 reqBuilder.addHeader("Accept", "application/json"); 69 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 70 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 71 reqBuilder.addHeader("Content-Type", "application/json"); 72 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 73 reqBuilder.method(METHOD, requestBody); 74 Request httpRequest = reqBuilder.build(); 75 76 // 发送HTTP请求 77 OkHttpClient client = new OkHttpClient.Builder().build(); 78 try (Response httpResponse = client.newCall(httpRequest).execute()) { 79 String respBody = WXPayUtility.extractBody(httpResponse); 80 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 81 // 2XX 成功,验证应答签名 82 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 83 httpResponse.headers(), respBody); 84 85 // 从HTTP应答报文构建返回数据 86 return WXPayUtility.fromJson(respBody, ProductCouponEntity.class); 87 } else { 88 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 89 } 90 } catch (IOException e) { 91 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 92 } 93 } 94 95 private final String mchid; 96 private final String certificateSerialNo; 97 private final PrivateKey privateKey; 98 private final String wechatPayPublicKeyId; 99 private final PublicKey wechatPayPublicKey; 100 101 public UpdateProductCoupon(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 102 this.mchid = mchid; 103 this.certificateSerialNo = certificateSerialNo; 104 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 105 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 106 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 107 } 108 109 public static class UpdateProductCouponRequest { 110 @SerializedName("out_request_no") 111 public String outRequestNo; 112 113 @SerializedName("product_coupon_id") 114 @Expose(serialize = false) 115 public String productCouponId; 116 117 @SerializedName("display_info") 118 public ProductCouponDisplayInfo displayInfo; 119 120 @SerializedName("brand_id") 121 public String brandId; 122 } 123 124 public static class ProductCouponEntity { 125 @SerializedName("product_coupon_id") 126 public String productCouponId; 127 128 @SerializedName("scope") 129 public ProductCouponScope scope; 130 131 @SerializedName("type") 132 public ProductCouponType type; 133 134 @SerializedName("usage_mode") 135 public UsageMode usageMode; 136 137 @SerializedName("single_usage_info") 138 public SingleUsageInfo singleUsageInfo; 139 140 @SerializedName("progressive_bundle_usage_info") 141 public ProgressiveBundleUsageInfo progressiveBundleUsageInfo; 142 143 @SerializedName("display_info") 144 public ProductCouponDisplayInfo displayInfo; 145 146 @SerializedName("out_product_no") 147 public String outProductNo; 148 149 @SerializedName("state") 150 public ProductCouponState state; 151 152 @SerializedName("deactivate_request_no") 153 public String deactivateRequestNo; 154 155 @SerializedName("deactivate_time") 156 public String deactivateTime; 157 158 @SerializedName("deactivate_reason") 159 public String deactivateReason; 160 161 @SerializedName("brand_id") 162 public String brandId; 163 } 164 165 public static class ProductCouponDisplayInfo { 166 @SerializedName("name") 167 public String name; 168 169 @SerializedName("image_url") 170 public String imageUrl; 171 172 @SerializedName("background_url") 173 public String backgroundUrl; 174 175 @SerializedName("detail_image_url_list") 176 public List<String> detailImageUrlList; 177 178 @SerializedName("original_price") 179 public Long originalPrice; 180 181 @SerializedName("combo_package_list") 182 public List<ComboPackage> comboPackageList; 183 } 184 185 public enum ProductCouponScope { 186 @SerializedName("ALL") 187 ALL, 188 @SerializedName("SINGLE") 189 SINGLE 190 } 191 192 public enum ProductCouponType { 193 @SerializedName("NORMAL") 194 NORMAL, 195 @SerializedName("DISCOUNT") 196 DISCOUNT, 197 @SerializedName("EXCHANGE") 198 EXCHANGE 199 } 200 201 public enum UsageMode { 202 @SerializedName("SINGLE") 203 SINGLE, 204 @SerializedName("PROGRESSIVE_BUNDLE") 205 PROGRESSIVE_BUNDLE 206 } 207 208 public static class SingleUsageInfo { 209 @SerializedName("normal_coupon") 210 public NormalCouponUsageRule normalCoupon; 211 212 @SerializedName("discount_coupon") 213 public DiscountCouponUsageRule discountCoupon; 214 } 215 216 public static class ProgressiveBundleUsageInfo { 217 @SerializedName("count") 218 public Long count; 219 220 @SerializedName("interval_days") 221 public Long intervalDays; 222 } 223 224 public enum ProductCouponState { 225 @SerializedName("AUDITING") 226 AUDITING, 227 @SerializedName("EFFECTIVE") 228 EFFECTIVE, 229 @SerializedName("DEACTIVATED") 230 DEACTIVATED 231 } 232 233 public static class ComboPackage { 234 @SerializedName("name") 235 public String name; 236 237 @SerializedName("pick_count") 238 public Long pickCount; 239 240 @SerializedName("choice_list") 241 public List<ComboPackageChoice> choiceList = new ArrayList<ComboPackageChoice>(); 242 } 243 244 public static class NormalCouponUsageRule { 245 @SerializedName("threshold") 246 public Long threshold; 247 248 @SerializedName("discount_amount") 249 public Long discountAmount; 250 } 251 252 public static class DiscountCouponUsageRule { 253 @SerializedName("threshold") 254 public Long threshold; 255 256 @SerializedName("percent_off") 257 public Long percentOff; 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 "bytes" 5 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446 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/v3/partner/4013080340 15 config, err := wxpay_utility.CreateMchConfig( 16 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 17 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 18 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 19 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 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_utility.String("12345_20250101_A3489"), 29 ProductCouponId: wxpay_utility.String("1000000013"), 30 DisplayInfo: &ProductCouponDisplayInfo{ 31 Name: wxpay_utility.String("全场满100立打8折-新名字"), 32 ImageUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"), 33 BackgroundUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"), 34 DetailImageUrlList: []string{ 35 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 36 }, 37 }, 38 BrandId: wxpay_utility.String("120344"), 39 } 40 41 response, err := UpdateProductCoupon(config, request) 42 if err != nil { 43 fmt.Printf("请求失败: %+v\n", err) 44 // TODO: 请求失败,根据状态码执行不同的处理 45 return 46 } 47 48 // TODO: 请求成功,继续业务逻辑 49 fmt.Printf("请求成功: %+v\n", response) 50} 51 52func UpdateProductCoupon(config *wxpay_utility.MchConfig, request *UpdateProductCouponRequest) (response *ProductCouponEntity, err error) { 53 const ( 54 host = "https://api.mch.weixin.qq.com" 55 method = "PATCH" 56 path = "/v3/marketing/partner/product-coupon/product-coupons/{product_coupon_id}" 57 ) 58 59 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 60 if err != nil { 61 return nil, err 62 } 63 reqUrl.Path = strings.Replace(reqUrl.Path, "{product_coupon_id}", url.PathEscape(*request.ProductCouponId), -1) 64 reqBody, err := json.Marshal(request) 65 if err != nil { 66 return nil, err 67 } 68 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 69 if err != nil { 70 return nil, err 71 } 72 httpRequest.Header.Set("Accept", "application/json") 73 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 74 httpRequest.Header.Set("Content-Type", "application/json") 75 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 76 if err != nil { 77 return nil, err 78 } 79 httpRequest.Header.Set("Authorization", authorization) 80 81 client := &http.Client{} 82 httpResponse, err := client.Do(httpRequest) 83 if err != nil { 84 return nil, err 85 } 86 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 87 if err != nil { 88 return nil, err 89 } 90 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 91 // 2XX 成功,验证应答签名 92 err = wxpay_utility.ValidateResponse( 93 config.WechatPayPublicKeyId(), 94 config.WechatPayPublicKey(), 95 &httpResponse.Header, 96 respBody, 97 ) 98 if err != nil { 99 return nil, err 100 } 101 response := &ProductCouponEntity{} 102 if err := json.Unmarshal(respBody, response); err != nil { 103 return nil, err 104 } 105 106 return response, nil 107 } else { 108 return nil, wxpay_utility.NewApiException( 109 httpResponse.StatusCode, 110 httpResponse.Header, 111 respBody, 112 ) 113 } 114} 115 116type UpdateProductCouponRequest struct { 117 OutRequestNo *string `json:"out_request_no,omitempty"` 118 ProductCouponId *string `json:"product_coupon_id,omitempty"` 119 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"` 120 BrandId *string `json:"brand_id,omitempty"` 121} 122 123func (o *UpdateProductCouponRequest) MarshalJSON() ([]byte, error) { 124 type Alias UpdateProductCouponRequest 125 a := &struct { 126 ProductCouponId *string `json:"product_coupon_id,omitempty"` 127 *Alias 128 }{ 129 // 序列化时移除非 Body 字段 130 ProductCouponId: nil, 131 Alias: (*Alias)(o), 132 } 133 return json.Marshal(a) 134} 135 136type ProductCouponEntity struct { 137 ProductCouponId *string `json:"product_coupon_id,omitempty"` 138 Scope *ProductCouponScope `json:"scope,omitempty"` 139 Type *ProductCouponType `json:"type,omitempty"` 140 UsageMode *UsageMode `json:"usage_mode,omitempty"` 141 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"` 142 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"` 143 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"` 144 OutProductNo *string `json:"out_product_no,omitempty"` 145 State *ProductCouponState `json:"state,omitempty"` 146 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"` 147 DeactivateTime *string `json:"deactivate_time,omitempty"` 148 DeactivateReason *string `json:"deactivate_reason,omitempty"` 149 BrandId *string `json:"brand_id,omitempty"` 150} 151 152type ProductCouponDisplayInfo struct { 153 Name *string `json:"name,omitempty"` 154 ImageUrl *string `json:"image_url,omitempty"` 155 BackgroundUrl *string `json:"background_url,omitempty"` 156 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"` 157 OriginalPrice *int64 `json:"original_price,omitempty"` 158 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"` 159} 160 161type ProductCouponScope string 162 163func (e ProductCouponScope) Ptr() *ProductCouponScope { 164 return &e 165} 166 167const ( 168 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL" 169 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE" 170) 171 172type ProductCouponType string 173 174func (e ProductCouponType) Ptr() *ProductCouponType { 175 return &e 176} 177 178const ( 179 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL" 180 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT" 181 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE" 182) 183 184type UsageMode string 185 186func (e UsageMode) Ptr() *UsageMode { 187 return &e 188} 189 190const ( 191 USAGEMODE_SINGLE UsageMode = "SINGLE" 192 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE" 193) 194 195type SingleUsageInfo struct { 196 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"` 197 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"` 198} 199 200type ProgressiveBundleUsageInfo struct { 201 Count *int64 `json:"count,omitempty"` 202 IntervalDays *int64 `json:"interval_days,omitempty"` 203} 204 205type ProductCouponState string 206 207func (e ProductCouponState) Ptr() *ProductCouponState { 208 return &e 209} 210 211const ( 212 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING" 213 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE" 214 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED" 215) 216 217type ComboPackage struct { 218 Name *string `json:"name,omitempty"` 219 PickCount *int64 `json:"pick_count,omitempty"` 220 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"` 221} 222 223type NormalCouponUsageRule struct { 224 Threshold *int64 `json:"threshold,omitempty"` 225 DiscountAmount *int64 `json:"discount_amount,omitempty"` 226} 227 228type DiscountCouponUsageRule struct { 229 Threshold *int64 `json:"threshold,omitempty"` 230 PercentOff *int64 `json:"percent_off,omitempty"` 231} 232 233type ComboPackageChoice struct { 234 Name *string `json:"name,omitempty"` 235 Price *int64 `json:"price,omitempty"` 236 Count *int64 `json:"count,omitempty"` 237 ImageUrl *string `json:"image_url,omitempty"` 238 MiniProgramAppid *string `json:"mini_program_appid,omitempty"` 239 MiniProgramPath *string `json:"mini_program_path,omitempty"` 240} 241
应答参数
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 【商品券图片】 商品图片的链接地址,仅支持通过图片上传接口获取的图片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(128)
【失效请求单号】 当且仅当 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(150)
【失效原因】 当且仅当 state 为 DEACTIVATED 时提供,返回品牌方调用失效商品券接口时传入的失效原因
brand_id 必填 string
【品牌ID】 微信支付为品牌方分配的唯一标识,该品牌应与服务商存在授权关系
应答示例
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 "brand_id" : "120344" 23} 24
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示
状态码 | 错误码 | 描述 | 解决方案 |
|---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
400 | INVALID_REQUEST | 传入参数不符合业务规则 | 请参考文档中对每个字段的要求以及组合要求,确认请求参数是否满足 |
404 | NOT_FOUND | 未找到 product_coupon_id 对应的商品券 | 请确认 product_coupon_id 存在且属于当前品牌 |
429 | RATELIMIT_EXCEEDED | 请求超过接口频率限制 | 请稍后使用原参数重试 |
