修改商家券基本信息
更新时间:2024.11.18商户可以通过该接口修改商家券基本信息
前置条件: 已创建商家券批次,且修改时间位于有效期结束时间前
接口说明
支持商户:【普通服务商】 【渠道商】
请求方式:【PATCH】/v3/marketing/busifavor/stocks/{stock_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 路径参数
stock_id 必填 string
【批次号】批次号
body 包体参数
custom_entrance 选填 object
【自定义入口】卡详情页面,可选择多种入口引导用户
属性 | |||||
mini_programs_info 选填 object 【小程序入口】需要小程序APPID、path、入口文案、引导文案。如果需要跳转小程序,APPID、path、入口文案为必填,引导文案非必填。AppID要与归属商户号有绑定关系
appid 选填 string 【商户公众号AppID】可配置商户公众号,从券详情可跳转至公众号 hall_id 选填 string 【更多优惠入口;营销馆创建地址:https://pay.weixin.qq.com/index.php/xphp/cfav_market/hall#/pages/list/list】 填写微信支付营销馆的馆id,用户自定义字段。营销馆需在商户平台创建。 code_display_mode 选填 string 【code展示模式】code展示模式 可选取值::
|
stock_name 选填 string
【批次名称】批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。
注:该字段暂不支持修改
comment 选填 string
【批次备注】仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。
goods_name 选填 string
【适用商品范围】用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
out_request_no 必填 string
【商户请求单号】商户修改批次凭据号(格式:商户ID+日期+流水号),商户侧需保持唯一性。
display_pattern_info 选填 object
【样式信息】
属性 | |||||
description 选填 string(1000) 【使用须知】用于说明详细的活动规则,会展示在代金券详情页。 merchant_logo_url 选填 string 【商户logo】若券归属商户号有认证品牌,则系统将自动拉取对应品牌logo;若券归属商户号不在认证品牌下,需自定义上传logo,未上传时将展示兜底灰色logo样式,影响券详情页用户体验,请及时上传。 merchant_name 选填 string(16) 【商户名称】不支持商户自定义。若券归属商户号有认证品牌,系统将自动拉取认证品牌号下的品牌名称;若券归属商户号不在认证品牌下,则拉取本商户号的商户简称。展示上限12个字符。 background_color 选填 string 【背景颜色】券的背景颜色,可设置10种颜色,色值请参考下方说明。颜色取值为颜色图中的颜色名称。
coupon_image_url 选填 string 【券详情图片】券详情图片,1074像素(宽)*603像素(高),图片大小不超过2M,支持JPG/PNG格式。仅支持通过《图片上传API》接口获取的图片URL地址。* finder_info 选填 object 【视频号相关信息】视频号相关信息
|
coupon_use_rule 选填 object
【核销规则】券核销相关规则
属性 | |
use_method 选填 string 【核销方式】核销方式 可选取值:
mini_programs_appid 选填 string 【小程序AppID】核销方式为线上小程序核销才有效 mini_programs_path 选填 string 【小程序path】核销方式为线上小程序核销才有效 |
stock_send_rule 选填 object
【发放规则】券发放相关规则
属性 | |
natural_person_limit 选填 boolean 【是否开启自然人限领】true-是;false-否,不填默认否 prevent_api_abuse 选填 boolean 【可疑账号拦截】true-是;false-否,不填默认否 |
notify_config 选填 object
【事件通知配置】事件回调通知商户的配置
属性 | |
notify_appid 选填 string(64) 【事件通知AppID】用于回调通知时,计算返回操作用户的OpenID(诸如领券用户),支持小程序or公众号的AppID;如该字段不填写,则回调通知中涉及到用户身份信息的OpenID与UnionID都将为空。 |
subsidy 选填 boolean
【是否允许营销补差】该批次发放的券是否允许进行补差。只允许从false改为true,不支持从true改为false
注:该字段暂未开放
请求示例
PATCH
1curl -X PATCH \ 2 https://api.mch.weixin.qq.com/v3/marketing/busifavor/stocks/101156451224 \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Content-Type: application/json" \ 6 -d '{ 7 "custom_entrance" : { 8 "mini_programs_info" : { 9 "mini_programs_appid" : "wx234545656765876", 10 "mini_programs_path" : "/path/index/index", 11 "entrance_words" : "欢迎选购", 12 "guiding_words" : "获取更多优惠" 13 }, 14 "appid" : "wx324345hgfhfghfg", 15 "hall_id" : "233455656", 16 "code_display_mode" : "BARCODE" 17 }, 18 "stock_name" : "8月1日活动券", 19 "comment" : "活动使用", 20 "goods_name" : "xxx商品使用", 21 "out_request_no" : "6122352020010133287985742", 22 "display_pattern_info" : { 23 "description" : "xxx门店可用", 24 "merchant_logo_url" : "https://xxx", 25 "merchant_name" : "微信支付", 26 "background_color" : "xxxxx", 27 "coupon_image_url" : "图片cdn地址", 28 "finder_info" : { 29 "finder_id" : "sph6Rngt2T4RlUf", 30 "finder_video_id" : "export/UzFfAgtgekIEAQAAAAAAb4MgnPInmAAAAAstQy6ubaLX4KHWvLEZgBPEwIEgVnk9HIP-zNPgMJofG6tpdGPJNg_ojtEjoT94", 31 "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/xxx" 32 } 33 }, 34 "coupon_use_rule" : { 35 "use_method" : "OFF_LINE", 36 "mini_programs_appid" : "wx23232232323", 37 "mini_programs_path" : "/path/index/index" 38 }, 39 "stock_send_rule" : { 40 "natural_person_limit" : false, 41 "prevent_api_abuse" : false 42 }, 43 "notify_config" : { 44 "notify_appid" : "wx23232232323" 45 }, 46 "subsidy" : true 47 }' 48
需配合微信支付工具库 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 ModifyStockInfo { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "PATCH"; 28 private static String PATH = "/v3/marketing/busifavor/stocks/{stock_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 ModifyStockInfo client = new ModifyStockInfo( 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 ModifyStockInfoRequest request = new ModifyStockInfoRequest(); 41 request.stockId = "101156451224"; 42 request.customEntrance = new ModifyCustomEntrance(); 43 request.customEntrance.miniProgramsInfo = new ModifyMiniAppInfo(); 44 request.customEntrance.miniProgramsInfo.miniProgramsAppid = "wx234545656765876"; 45 request.customEntrance.miniProgramsInfo.miniProgramsPath = "/path/index/index"; 46 request.customEntrance.miniProgramsInfo.entranceWords = "欢迎选购"; 47 request.customEntrance.miniProgramsInfo.guidingWords = "获取更多优惠"; 48 request.customEntrance.appid = "wx324345hgfhfghfg"; 49 request.customEntrance.hallId = "233455656"; 50 request.customEntrance.codeDisplayMode = CodeDisplayMode.BARCODE; 51 request.stockName = "8月1日活动券"; 52 request.comment = "活动使用"; 53 request.goodsName = "xxx商品使用"; 54 request.outRequestNo = "6122352020010133287985742"; 55 request.displayPatternInfo = new DisplayPatternInfo(); 56 request.displayPatternInfo.description = "xxx门店可用"; 57 request.displayPatternInfo.merchantLogoUrl = "https://xxx"; 58 request.displayPatternInfo.merchantName = "微信支付"; 59 request.displayPatternInfo.backgroundColor = "xxxxx"; 60 request.displayPatternInfo.couponImageUrl = "图片cdn地址"; 61 request.displayPatternInfo.finderInfo = new FinderInfo(); 62 request.displayPatternInfo.finderInfo.finderId = "sph6Rngt2T4RlUf"; 63 request.displayPatternInfo.finderInfo.finderVideoId = "export/UzFfAgtgekIEAQAAAAAAb4MgnPInmAAAAAstQy6ubaLX4KHWvLEZgBPEwIEgVnk9HIP-zNPgMJofG6tpdGPJNg_ojtEjoT94"; 64 request.displayPatternInfo.finderInfo.finderVideoCoverImageUrl = "https://wxpaylogo.qpic.cn/xxx"; 65 request.couponUseRule = new ModifyCouponUseRule(); 66 request.couponUseRule.useMethod = CouponUseMethod.OFF_LINE; 67 request.couponUseRule.miniProgramsAppid = "wx23232232323"; 68 request.couponUseRule.miniProgramsPath = "/path/index/index"; 69 request.stockSendRule = new ModifyStockSendRule(); 70 request.stockSendRule.naturalPersonLimit = false; 71 request.stockSendRule.preventApiAbuse = false; 72 request.notifyConfig = new NotifyConfig(); 73 request.notifyConfig.notifyAppid = "wx23232232323"; 74 request.subsidy = true; 75 try { 76 client.run(request); 77 } catch (WXPayUtility.ApiException e) { 78 // TODO: 请求失败,根据状态码执行不同的逻辑 79 e.printStackTrace(); 80 } 81 } 82 83 public void run(ModifyStockInfoRequest request) { 84 String uri = PATH; 85 uri = uri.replace("{stock_id}", WXPayUtility.urlEncode(request.stockId)); 86 String reqBody = WXPayUtility.toJson(request); 87 88 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 89 reqBuilder.addHeader("Accept", "application/json"); 90 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 91 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 92 reqBuilder.addHeader("Content-Type", "application/json"); 93 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 94 reqBuilder.method(METHOD, requestBody); 95 Request httpRequest = reqBuilder.build(); 96 97 // 发送HTTP请求 98 OkHttpClient client = new OkHttpClient.Builder().build(); 99 try (Response httpResponse = client.newCall(httpRequest).execute()) { 100 String respBody = WXPayUtility.extractBody(httpResponse); 101 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 102 // 2XX 成功,验证应答签名 103 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 104 httpResponse.headers(), respBody); 105 106 return; 107 } else { 108 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 109 } 110 } catch (IOException e) { 111 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 112 } 113 } 114 115 private final String mchid; 116 private final String certificateSerialNo; 117 private final PrivateKey privateKey; 118 private final String wechatPayPublicKeyId; 119 private final PublicKey wechatPayPublicKey; 120 121 public ModifyStockInfo(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 122 this.mchid = mchid; 123 this.certificateSerialNo = certificateSerialNo; 124 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 125 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 126 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 127 } 128 129 public static class ModifyStockInfoRequest { 130 @SerializedName("stock_id") 131 @Expose(serialize = false) 132 public String stockId; 133 134 @SerializedName("custom_entrance") 135 public ModifyCustomEntrance customEntrance; 136 137 @SerializedName("stock_name") 138 public String stockName; 139 140 @SerializedName("comment") 141 public String comment; 142 143 @SerializedName("goods_name") 144 public String goodsName; 145 146 @SerializedName("out_request_no") 147 public String outRequestNo; 148 149 @SerializedName("display_pattern_info") 150 public DisplayPatternInfo displayPatternInfo; 151 152 @SerializedName("coupon_use_rule") 153 public ModifyCouponUseRule couponUseRule; 154 155 @SerializedName("stock_send_rule") 156 public ModifyStockSendRule stockSendRule; 157 158 @SerializedName("notify_config") 159 public NotifyConfig notifyConfig; 160 161 @SerializedName("subsidy") 162 public Boolean subsidy; 163 } 164 165 public static class ModifyCustomEntrance { 166 @SerializedName("mini_programs_info") 167 public ModifyMiniAppInfo miniProgramsInfo; 168 169 @SerializedName("appid") 170 public String appid; 171 172 @SerializedName("hall_id") 173 public String hallId; 174 175 @SerializedName("code_display_mode") 176 public CodeDisplayMode codeDisplayMode; 177 } 178 179 public static class DisplayPatternInfo { 180 @SerializedName("description") 181 public String description; 182 183 @SerializedName("merchant_logo_url") 184 public String merchantLogoUrl; 185 186 @SerializedName("merchant_name") 187 public String merchantName; 188 189 @SerializedName("background_color") 190 public String backgroundColor; 191 192 @SerializedName("coupon_image_url") 193 public String couponImageUrl; 194 195 @SerializedName("finder_info") 196 public FinderInfo finderInfo; 197 } 198 199 public static class ModifyCouponUseRule { 200 @SerializedName("use_method") 201 public CouponUseMethod useMethod; 202 203 @SerializedName("mini_programs_appid") 204 public String miniProgramsAppid; 205 206 @SerializedName("mini_programs_path") 207 public String miniProgramsPath; 208 } 209 210 public static class ModifyStockSendRule { 211 @SerializedName("natural_person_limit") 212 public Boolean naturalPersonLimit; 213 214 @SerializedName("prevent_api_abuse") 215 public Boolean preventApiAbuse; 216 } 217 218 public static class NotifyConfig { 219 @SerializedName("notify_appid") 220 public String notifyAppid; 221 } 222 223 public static class ModifyMiniAppInfo { 224 @SerializedName("mini_programs_appid") 225 public String miniProgramsAppid; 226 227 @SerializedName("mini_programs_path") 228 public String miniProgramsPath; 229 230 @SerializedName("entrance_words") 231 public String entranceWords; 232 233 @SerializedName("guiding_words") 234 public String guidingWords; 235 } 236 237 public enum CodeDisplayMode { 238 @SerializedName("NOT_SHOW") 239 NOT_SHOW, 240 @SerializedName("BARCODE") 241 BARCODE, 242 @SerializedName("QRCODE") 243 QRCODE 244 } 245 246 public static class FinderInfo { 247 @SerializedName("finder_id") 248 public String finderId; 249 250 @SerializedName("finder_video_id") 251 public String finderVideoId; 252 253 @SerializedName("finder_video_cover_image_url") 254 public String finderVideoCoverImageUrl; 255 } 256 257 public enum CouponUseMethod { 258 @SerializedName("OFF_LINE") 259 OFF_LINE, 260 @SerializedName("MINI_PROGRAMS") 261 MINI_PROGRAMS, 262 @SerializedName("SELF_CONSUME") 263 SELF_CONSUME, 264 @SerializedName("PAYMENT_CODE") 265 PAYMENT_CODE 266 } 267 268} 269
需配合微信支付工具库 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 := &ModifyStockInfoRequest{ 28 StockId: wxpay_utility.String("101156451224"), 29 CustomEntrance: &ModifyCustomEntrance{ 30 MiniProgramsInfo: &ModifyMiniAppInfo{ 31 MiniProgramsAppid: wxpay_utility.String("wx234545656765876"), 32 MiniProgramsPath: wxpay_utility.String("/path/index/index"), 33 EntranceWords: wxpay_utility.String("欢迎选购"), 34 GuidingWords: wxpay_utility.String("获取更多优惠"), 35 }, 36 Appid: wxpay_utility.String("wx324345hgfhfghfg"), 37 HallId: wxpay_utility.String("233455656"), 38 CodeDisplayMode: CODEDISPLAYMODE_BARCODE.Ptr(), 39 }, 40 StockName: wxpay_utility.String("8月1日活动券"), 41 Comment: wxpay_utility.String("活动使用"), 42 GoodsName: wxpay_utility.String("xxx商品使用"), 43 OutRequestNo: wxpay_utility.String("6122352020010133287985742"), 44 DisplayPatternInfo: &DisplayPatternInfo{ 45 Description: wxpay_utility.String("xxx门店可用"), 46 MerchantLogoUrl: wxpay_utility.String("https://xxx"), 47 MerchantName: wxpay_utility.String("微信支付"), 48 BackgroundColor: wxpay_utility.String("xxxxx"), 49 CouponImageUrl: wxpay_utility.String("图片cdn地址"), 50 FinderInfo: &FinderInfo{ 51 FinderId: wxpay_utility.String("sph6Rngt2T4RlUf"), 52 FinderVideoId: wxpay_utility.String("export/UzFfAgtgekIEAQAAAAAAb4MgnPInmAAAAAstQy6ubaLX4KHWvLEZgBPEwIEgVnk9HIP-zNPgMJofG6tpdGPJNg_ojtEjoT94"), 53 FinderVideoCoverImageUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/xxx"), 54 }, 55 }, 56 CouponUseRule: &ModifyCouponUseRule{ 57 UseMethod: COUPONUSEMETHOD_OFF_LINE.Ptr(), 58 MiniProgramsAppid: wxpay_utility.String("wx23232232323"), 59 MiniProgramsPath: wxpay_utility.String("/path/index/index"), 60 }, 61 StockSendRule: &ModifyStockSendRule{ 62 NaturalPersonLimit: wxpay_utility.Bool(false), 63 PreventApiAbuse: wxpay_utility.Bool(false), 64 }, 65 NotifyConfig: &NotifyConfig{ 66 NotifyAppid: wxpay_utility.String("wx23232232323"), 67 }, 68 Subsidy: wxpay_utility.Bool(true), 69 } 70 71 err = ModifyStockInfo(config, request) 72 if err != nil { 73 fmt.Printf("请求失败: %+v\n", err) 74 // TODO: 请求失败,根据状态码执行不同的处理 75 return 76 } 77 78 // TODO: 请求成功,继续业务逻辑 79 fmt.Println("请求成功") 80} 81 82func ModifyStockInfo(config *wxpay_utility.MchConfig, request *ModifyStockInfoRequest) (err error) { 83 const ( 84 host = "https://api.mch.weixin.qq.com" 85 method = "PATCH" 86 path = "/v3/marketing/busifavor/stocks/{stock_id}" 87 ) 88 89 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 90 if err != nil { 91 return err 92 } 93 reqUrl.Path = strings.Replace(reqUrl.Path, "{stock_id}", url.PathEscape(*request.StockId), -1) 94 reqBody, err := json.Marshal(request) 95 if err != nil { 96 return err 97 } 98 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 99 if err != nil { 100 return err 101 } 102 httpRequest.Header.Set("Accept", "application/json") 103 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 104 httpRequest.Header.Set("Content-Type", "application/json") 105 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 106 if err != nil { 107 return err 108 } 109 httpRequest.Header.Set("Authorization", authorization) 110 111 client := &http.Client{} 112 httpResponse, err := client.Do(httpRequest) 113 if err != nil { 114 return err 115 } 116 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 117 if err != nil { 118 return err 119 } 120 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 121 // 2XX 成功,验证应答签名 122 err = wxpay_utility.ValidateResponse( 123 config.WechatPayPublicKeyId(), 124 config.WechatPayPublicKey(), 125 &httpResponse.Header, 126 respBody, 127 ) 128 if err != nil { 129 return err 130 } 131 return nil 132 } else { 133 return wxpay_utility.NewApiException( 134 httpResponse.StatusCode, 135 httpResponse.Header, 136 respBody, 137 ) 138 } 139} 140 141type ModifyStockInfoRequest struct { 142 StockId *string `json:"stock_id,omitempty"` 143 CustomEntrance *ModifyCustomEntrance `json:"custom_entrance,omitempty"` 144 StockName *string `json:"stock_name,omitempty"` 145 Comment *string `json:"comment,omitempty"` 146 GoodsName *string `json:"goods_name,omitempty"` 147 OutRequestNo *string `json:"out_request_no,omitempty"` 148 DisplayPatternInfo *DisplayPatternInfo `json:"display_pattern_info,omitempty"` 149 CouponUseRule *ModifyCouponUseRule `json:"coupon_use_rule,omitempty"` 150 StockSendRule *ModifyStockSendRule `json:"stock_send_rule,omitempty"` 151 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"` 152 Subsidy *bool `json:"subsidy,omitempty"` 153} 154 155func (o *ModifyStockInfoRequest) MarshalJSON() ([]byte, error) { 156 type Alias ModifyStockInfoRequest 157 a := &struct { 158 StockId *string `json:"stock_id,omitempty"` 159 *Alias 160 }{ 161 // 序列化时移除非 Body 字段 162 StockId: nil, 163 Alias: (*Alias)(o), 164 } 165 return json.Marshal(a) 166} 167 168type ModifyCustomEntrance struct { 169 MiniProgramsInfo *ModifyMiniAppInfo `json:"mini_programs_info,omitempty"` 170 Appid *string `json:"appid,omitempty"` 171 HallId *string `json:"hall_id,omitempty"` 172 CodeDisplayMode *CodeDisplayMode `json:"code_display_mode,omitempty"` 173} 174 175type DisplayPatternInfo struct { 176 Description *string `json:"description,omitempty"` 177 MerchantLogoUrl *string `json:"merchant_logo_url,omitempty"` 178 MerchantName *string `json:"merchant_name,omitempty"` 179 BackgroundColor *string `json:"background_color,omitempty"` 180 CouponImageUrl *string `json:"coupon_image_url,omitempty"` 181 FinderInfo *FinderInfo `json:"finder_info,omitempty"` 182} 183 184type ModifyCouponUseRule struct { 185 UseMethod *CouponUseMethod `json:"use_method,omitempty"` 186 MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"` 187 MiniProgramsPath *string `json:"mini_programs_path,omitempty"` 188} 189 190type ModifyStockSendRule struct { 191 NaturalPersonLimit *bool `json:"natural_person_limit,omitempty"` 192 PreventApiAbuse *bool `json:"prevent_api_abuse,omitempty"` 193} 194 195type NotifyConfig struct { 196 NotifyAppid *string `json:"notify_appid,omitempty"` 197} 198 199type ModifyMiniAppInfo struct { 200 MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"` 201 MiniProgramsPath *string `json:"mini_programs_path,omitempty"` 202 EntranceWords *string `json:"entrance_words,omitempty"` 203 GuidingWords *string `json:"guiding_words,omitempty"` 204} 205 206type CodeDisplayMode string 207 208func (e CodeDisplayMode) Ptr() *CodeDisplayMode { 209 return &e 210} 211 212const ( 213 CODEDISPLAYMODE_NOT_SHOW CodeDisplayMode = "NOT_SHOW" 214 CODEDISPLAYMODE_BARCODE CodeDisplayMode = "BARCODE" 215 CODEDISPLAYMODE_QRCODE CodeDisplayMode = "QRCODE" 216) 217 218type FinderInfo struct { 219 FinderId *string `json:"finder_id,omitempty"` 220 FinderVideoId *string `json:"finder_video_id,omitempty"` 221 FinderVideoCoverImageUrl *string `json:"finder_video_cover_image_url,omitempty"` 222} 223 224type CouponUseMethod string 225 226func (e CouponUseMethod) Ptr() *CouponUseMethod { 227 return &e 228} 229 230const ( 231 COUPONUSEMETHOD_OFF_LINE CouponUseMethod = "OFF_LINE" 232 COUPONUSEMETHOD_MINI_PROGRAMS CouponUseMethod = "MINI_PROGRAMS" 233 COUPONUSEMETHOD_SELF_CONSUME CouponUseMethod = "SELF_CONSUME" 234 COUPONUSEMETHOD_PAYMENT_CODE CouponUseMethod = "PAYMENT_CODE" 235) 236
应答参数
无应答包体
应答示例
204 No Content
1'无应答包体' 2
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
业务错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | INVALID_REQUEST | 修改跳转到小程序的自定义入口请填入小程序AppID | 需要修改小程序自定义入口,请填入正确的小程序AppID |
400 | INVALID_REQUEST | 修改字段中包含敏感词 | 请更换提示的敏感词字段后重试 |
400 | INVALID_REQUEST | 修改的AppID与商户号没有绑定关系 | 请更换正确的AppID后重试 |
400 | INVALID_REQUEST | 修改的图片URL包含敏感内容 | 请更换待修改图片后重试 |
403 | RULE_LIMIT | 修改流程中仅允许创建方进行操作 | 仅允许调用方进行修改,请更换调用API的商户号 |
403 | RULE_LIMIT | 修改的营销馆无权限 | 请更换正确的营销馆ID后重试 |
404 | RESOURCE_NOT_EXISTS | 批次不存在 | 请检查批次ID后重试 |
404 | RESOURCE_NOT_EXISTS | 修改的AppID不合法 | 请更换正确的AppID后重试 |
404 | RESOURCE_NOT_EXISTS | 营销馆ID不存在 | 请更换正确的营销馆ID后重试 |