查询用户商品券详情
更新时间:2025.09.02品牌方可以通过本接口查询已经发放给用户的商品券详情
前置条件:已经给用户发券成功
频率限制:500/s
接口说明
支持商户:【品牌商户】
请求方式:【GET】/brand/marketing/product-coupon/users/{openid}/coupons/{coupon_code}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Wechatpay-Serial 必填 string
【微信支付公钥ID】 请传入brand_id对应的微信支付公钥ID,接口将会校验两者的关联关系,参考微信支付公钥产品简介及使用说明获取微信支付公钥ID和相关的介绍。以下两种场景将使用到微信支付公钥: 1、接收到接口的返回内容,需要使用微信支付公钥进行验签; 2、调用含有敏感信息参数(如姓名、身份证号码)的接口时,需要使用微信支付公钥加密敏感信息后再传输参数,加密指引请参考微信支付公钥加密敏感信息指引。
path 路径参数
coupon_code 必填 string(40)
【用户商品券Code】 券的唯一标识
openid 必填 string
【用户OpenID】 OpenID信息,用户在AppID下的唯一标识,获取方式参考OpenID
query 查询参数
product_coupon_id 必填 string
【商品券ID】 商品券的唯一标识,创建商品券时由微信支付生成
stock_id 必填 string
【批次ID】 商品券批次的唯一标识,商品券批次创建时由微信支付生成(可使用创建商品券或添加商品券批次创建),请确保该批次属于 product_coupon_id 对应的商品券
appid 必填 string
【公众账号AppID】 请传入与当前调用接口品牌ID有绑定关系的AppID,如何绑定请参考品牌经营平台指引,支持小程序、服务号、公众号、APP类型的AppID
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/brand/marketing/product-coupon/users/oh-394z-6CGkNoJrsDLTTUKiAnp4/coupons/123446565767?product_coupon_id=1002323&stock_id=100232301&appid=wx233544546545989 \ 3 -H "Authorization: WECHATPAY-BRAND-SHA256-RSA2048 brand_id=\"XXXX\",..." \ 4 -H "Accept: application/json" \ 5 -H "Wechatpay-Serial: PUB_KEY_ID_XXXX" 6
需配合微信支付工具库 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 GetUserProductCoupon { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/brand/marketing/product-coupon/users/{openid}/coupons/{coupon_code}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 32 GetUserProductCoupon client = new GetUserProductCoupon( 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 GetUserProductCouponRequest request = new GetUserProductCouponRequest(); 41 request.couponCode = "123446565767"; 42 request.openid = "oh-394z-6CGkNoJrsDLTTUKiAnp4"; 43 request.productCouponId = "1002323"; 44 request.stockId = "100232301"; 45 request.appid = "wx233544546545989"; 46 try { 47 UserProductCouponEntity response = client.run(request); 48 // TODO: 请求成功,继续业务逻辑 49 System.out.println(response); 50 } catch (WXPayBrandUtility.ApiException e) { 51 // TODO: 请求失败,根据状态码执行不同的逻辑 52 e.printStackTrace(); 53 } 54 } 55 56 public UserProductCouponEntity run(GetUserProductCouponRequest request) { 57 String uri = PATH; 58 uri = uri.replace("{coupon_code}", WXPayBrandUtility.urlEncode(request.couponCode)); 59 uri = uri.replace("{openid}", WXPayBrandUtility.urlEncode(request.openid)); 60 Map<String, Object> args = new HashMap<>(); 61 args.put("product_coupon_id", request.productCouponId); 62 args.put("stock_id", request.stockId); 63 args.put("appid", request.appid); 64 String queryString = WXPayBrandUtility.urlEncode(args); 65 if (!queryString.isEmpty()) { 66 uri = uri + "?" + queryString; 67 } 68 69 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 70 reqBuilder.addHeader("Accept", "application/json"); 71 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 72 reqBuilder.addHeader("Authorization", WXPayBrandUtility.buildAuthorization(brand_id, certificateSerialNo, privateKey, METHOD, uri, null)); 73 reqBuilder.method(METHOD, null); 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 = WXPayBrandUtility.extractBody(httpResponse); 80 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 81 // 2XX 成功,验证应答签名 82 WXPayBrandUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 83 httpResponse.headers(), respBody); 84 85 // 从HTTP应答报文构建返回数据 86 return WXPayBrandUtility.fromJson(respBody, UserProductCouponEntity.class); 87 } else { 88 throw new WXPayBrandUtility.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 brand_id; 96 private final String certificateSerialNo; 97 private final PrivateKey privateKey; 98 private final String wechatPayPublicKeyId; 99 private final PublicKey wechatPayPublicKey; 100 101 public GetUserProductCoupon(String brand_id, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 102 this.brand_id = brand_id; 103 this.certificateSerialNo = certificateSerialNo; 104 this.privateKey = WXPayBrandUtility.loadPrivateKeyFromPath(privateKeyFilePath); 105 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 106 this.wechatPayPublicKey = WXPayBrandUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 107 } 108 109 public static class GetUserProductCouponRequest { 110 @SerializedName("product_coupon_id") 111 @Expose(serialize = false) 112 public String productCouponId; 113 114 @SerializedName("stock_id") 115 @Expose(serialize = false) 116 public String stockId; 117 118 @SerializedName("coupon_code") 119 @Expose(serialize = false) 120 public String couponCode; 121 122 @SerializedName("appid") 123 @Expose(serialize = false) 124 public String appid; 125 126 @SerializedName("openid") 127 @Expose(serialize = false) 128 public String openid; 129 } 130 131 public static class UserProductCouponEntity { 132 @SerializedName("coupon_code") 133 public String couponCode; 134 135 @SerializedName("coupon_state") 136 public UserProductCouponState couponState; 137 138 @SerializedName("valid_begin_time") 139 public String validBeginTime; 140 141 @SerializedName("valid_end_time") 142 public String validEndTime; 143 144 @SerializedName("receive_time") 145 public String receiveTime; 146 147 @SerializedName("send_request_no") 148 public String sendRequestNo; 149 150 @SerializedName("send_channel") 151 public UserProductCouponSendChannel sendChannel; 152 153 @SerializedName("confirm_request_no") 154 public String confirmRequestNo; 155 156 @SerializedName("confirm_time") 157 public String confirmTime; 158 159 @SerializedName("deactivate_request_no") 160 public String deactivateRequestNo; 161 162 @SerializedName("deactivate_time") 163 public String deactivateTime; 164 165 @SerializedName("deactivate_reason") 166 public String deactivateReason; 167 168 @SerializedName("single_usage_detail") 169 public SingleUsageDetail singleUsageDetail; 170 171 @SerializedName("sequential_usage_detail") 172 public SequentialUsageDetail sequentialUsageDetail; 173 174 @SerializedName("product_coupon") 175 public ProductCouponEntity productCoupon; 176 177 @SerializedName("stock") 178 public StockEntity stock; 179 180 @SerializedName("attach") 181 public String attach; 182 183 @SerializedName("channel_custom_info") 184 public String channelCustomInfo; 185 186 @SerializedName("coupon_tag_info") 187 public CouponTagInfo couponTagInfo; 188 } 189 190 public enum UserProductCouponState { 191 @SerializedName("CONFIRMING") 192 CONFIRMING, 193 @SerializedName("PENDING") 194 PENDING, 195 @SerializedName("EFFECTIVE") 196 EFFECTIVE, 197 @SerializedName("USED") 198 USED, 199 @SerializedName("EXPIRED") 200 EXPIRED, 201 @SerializedName("DELETED") 202 DELETED, 203 @SerializedName("DEACTIVATED") 204 DEACTIVATED 205 } 206 207 public enum UserProductCouponSendChannel { 208 @SerializedName("BRAND_MANAGE") 209 BRAND_MANAGE, 210 @SerializedName("API") 211 API, 212 @SerializedName("RECEIVE_COMPONENT") 213 RECEIVE_COMPONENT 214 } 215 216 public static class SingleUsageDetail { 217 @SerializedName("use_request_no") 218 public String useRequestNo; 219 220 @SerializedName("use_time") 221 public String useTime; 222 223 @SerializedName("associated_order_info") 224 public UserProductCouponAssociatedOrderInfo associatedOrderInfo; 225 226 @SerializedName("return_request_no") 227 public String returnRequestNo; 228 229 @SerializedName("return_time") 230 public String returnTime; 231 } 232 233 public static class SequentialUsageDetail { 234 @SerializedName("total_count") 235 public Long totalCount; 236 237 @SerializedName("used_count") 238 public Long usedCount; 239 240 @SerializedName("detail_item_list") 241 public List<SequentialUsageDetailItem> detailItemList; 242 } 243 244 public static class ProductCouponEntity { 245 @SerializedName("product_coupon_id") 246 public String productCouponId; 247 248 @SerializedName("scope") 249 public ProductCouponScope scope; 250 251 @SerializedName("type") 252 public ProductCouponType type; 253 254 @SerializedName("usage_mode") 255 public UsageMode usageMode; 256 257 @SerializedName("single_usage_info") 258 public SingleUsageInfo singleUsageInfo; 259 260 @SerializedName("sequential_usage_info") 261 public SequentialUsageInfo sequentialUsageInfo; 262 263 @SerializedName("display_info") 264 public ProductCouponDisplayInfo displayInfo; 265 266 @SerializedName("out_product_no") 267 public String outProductNo; 268 269 @SerializedName("state") 270 public ProductCouponState state; 271 272 @SerializedName("deactivate_request_no") 273 public String deactivateRequestNo; 274 275 @SerializedName("deactivate_time") 276 public String deactivateTime; 277 278 @SerializedName("deactivate_reason") 279 public String deactivateReason; 280 } 281 282 public static class StockEntity { 283 @SerializedName("product_coupon_id") 284 public String productCouponId; 285 286 @SerializedName("stock_id") 287 public String stockId; 288 289 @SerializedName("remark") 290 public String remark; 291 292 @SerializedName("coupon_code_mode") 293 public CouponCodeMode couponCodeMode; 294 295 @SerializedName("coupon_code_count_info") 296 public CouponCodeCountInfo couponCodeCountInfo; 297 298 @SerializedName("stock_send_rule") 299 public StockSendRule stockSendRule; 300 301 @SerializedName("single_usage_rule") 302 public SingleUsageRule singleUsageRule; 303 304 @SerializedName("sequential_usage_rule") 305 public SequentialUsageRule sequentialUsageRule; 306 307 @SerializedName("usage_rule_display_info") 308 public UsageRuleDisplayInfo usageRuleDisplayInfo; 309 310 @SerializedName("coupon_display_info") 311 public CouponDisplayInfo couponDisplayInfo; 312 313 @SerializedName("notify_config") 314 public NotifyConfig notifyConfig; 315 316 @SerializedName("store_scope") 317 public StockStoreScope storeScope; 318 319 @SerializedName("sent_count_info") 320 public StockSentCountInfo sentCountInfo; 321 322 @SerializedName("state") 323 public StockState state; 324 325 @SerializedName("deactivate_request_no") 326 public String deactivateRequestNo; 327 328 @SerializedName("deactivate_time") 329 public String deactivateTime; 330 331 @SerializedName("deactivate_reason") 332 public String deactivateReason; 333 } 334 335 public static class CouponTagInfo { 336 @SerializedName("coupon_tag_list") 337 public List<UserProductCouponTag> couponTagList; 338 339 @SerializedName("member_tag_info") 340 public MemberTagInfo memberTagInfo; 341 } 342 343 public static class UserProductCouponAssociatedOrderInfo { 344 @SerializedName("transaction_id") 345 public String transactionId; 346 347 @SerializedName("out_trade_no") 348 public String outTradeNo; 349 350 @SerializedName("mchid") 351 public String mchid; 352 353 @SerializedName("sub_mchid") 354 public String subMchid; 355 } 356 357 public static class SequentialUsageDetailItem { 358 @SerializedName("detail_state") 359 public UserProductCouponUsageDetailItemState detailState; 360 361 @SerializedName("valid_begin_time") 362 public String validBeginTime; 363 364 @SerializedName("valid_end_time") 365 public String validEndTime; 366 367 @SerializedName("use_request_no") 368 public String useRequestNo; 369 370 @SerializedName("use_time") 371 public String useTime; 372 373 @SerializedName("associated_order_info") 374 public UserProductCouponAssociatedOrderInfo associatedOrderInfo; 375 376 @SerializedName("return_request_no") 377 public String returnRequestNo; 378 379 @SerializedName("return_time") 380 public String returnTime; 381 382 @SerializedName("delete_time") 383 public String deleteTime; 384 } 385 386 public enum ProductCouponScope { 387 @SerializedName("ALL") 388 ALL, 389 @SerializedName("SINGLE") 390 SINGLE 391 } 392 393 public enum ProductCouponType { 394 @SerializedName("NORMAL") 395 NORMAL, 396 @SerializedName("DISCOUNT") 397 DISCOUNT, 398 @SerializedName("EXCHANGE") 399 EXCHANGE 400 } 401 402 public enum UsageMode { 403 @SerializedName("SINGLE") 404 SINGLE, 405 @SerializedName("SEQUENTIAL") 406 SEQUENTIAL 407 } 408 409 public static class SingleUsageInfo { 410 @SerializedName("normal_coupon") 411 public NormalCouponUsageRule normalCoupon; 412 413 @SerializedName("discount_coupon") 414 public DiscountCouponUsageRule discountCoupon; 415 } 416 417 public static class SequentialUsageInfo { 418 @SerializedName("type") 419 public SequentialUsageType type; 420 421 @SerializedName("count") 422 public Long count; 423 424 @SerializedName("available_days") 425 public Long availableDays; 426 427 @SerializedName("interval_days") 428 public Long intervalDays; 429 } 430 431 public static class ProductCouponDisplayInfo { 432 @SerializedName("name") 433 public String name; 434 435 @SerializedName("image_url") 436 public String imageUrl; 437 438 @SerializedName("background_url") 439 public String backgroundUrl; 440 441 @SerializedName("detail_image_url_list") 442 public List<String> detailImageUrlList; 443 444 @SerializedName("original_price") 445 public Long originalPrice; 446 447 @SerializedName("combo_package_list") 448 public List<ComboPackage> comboPackageList; 449 } 450 451 public enum ProductCouponState { 452 @SerializedName("AUDITING") 453 AUDITING, 454 @SerializedName("EFFECTIVE") 455 EFFECTIVE, 456 @SerializedName("DEACTIVATED") 457 DEACTIVATED 458 } 459 460 public enum CouponCodeMode { 461 @SerializedName("WECHATPAY") 462 WECHATPAY, 463 @SerializedName("UPLOAD") 464 UPLOAD, 465 @SerializedName("API_ASSIGN") 466 API_ASSIGN 467 } 468 469 public static class CouponCodeCountInfo { 470 @SerializedName("total_count") 471 public Long totalCount; 472 473 @SerializedName("available_count") 474 public Long availableCount; 475 } 476 477 public static class StockSendRule { 478 @SerializedName("max_count") 479 public Long maxCount; 480 481 @SerializedName("max_count_per_day") 482 public Long maxCountPerDay; 483 484 @SerializedName("max_count_per_user") 485 public Long maxCountPerUser; 486 } 487 488 public static class SingleUsageRule { 489 @SerializedName("coupon_available_period") 490 public SingleCouponAvailablePeriod couponAvailablePeriod; 491 492 @SerializedName("normal_coupon") 493 public NormalCouponUsageRule normalCoupon; 494 495 @SerializedName("discount_coupon") 496 public DiscountCouponUsageRule discountCoupon; 497 498 @SerializedName("exchange_coupon") 499 public ExchangeCouponUsageRule exchangeCoupon; 500 } 501 502 public static class SequentialUsageRule { 503 @SerializedName("coupon_available_period") 504 public SequentialCouponAvailablePeriod couponAvailablePeriod; 505 506 @SerializedName("normal_coupon_list") 507 public List<NormalCouponUsageRule> normalCouponList; 508 509 @SerializedName("discount_coupon_list") 510 public List<DiscountCouponUsageRule> discountCouponList; 511 512 @SerializedName("exchange_coupon_list") 513 public List<ExchangeCouponUsageRule> exchangeCouponList; 514 515 @SerializedName("special_first") 516 public Boolean specialFirst; 517 } 518 519 public static class UsageRuleDisplayInfo { 520 @SerializedName("coupon_usage_method_list") 521 public List<CouponUsageMethod> couponUsageMethodList = new ArrayList<CouponUsageMethod>(); 522 523 @SerializedName("mini_program_appid") 524 public String miniProgramAppid; 525 526 @SerializedName("mini_program_path") 527 public String miniProgramPath; 528 529 @SerializedName("app_path") 530 public String appPath; 531 532 @SerializedName("usage_description") 533 public String usageDescription; 534 535 @SerializedName("coupon_available_store_info") 536 public CouponAvailableStoreInfo couponAvailableStoreInfo; 537 } 538 539 public static class CouponDisplayInfo { 540 @SerializedName("code_display_mode") 541 public CouponCodeDisplayMode codeDisplayMode; 542 543 @SerializedName("background_color") 544 public String backgroundColor; 545 546 @SerializedName("entrance_mini_program") 547 public EntranceMiniProgram entranceMiniProgram; 548 549 @SerializedName("entrance_official_account") 550 public EntranceOfficialAccount entranceOfficialAccount; 551 552 @SerializedName("entrance_finder") 553 public EntranceFinder entranceFinder; 554 } 555 556 public static class NotifyConfig { 557 @SerializedName("notify_appid") 558 public String notifyAppid; 559 } 560 561 public enum StockStoreScope { 562 @SerializedName("NONE") 563 NONE, 564 @SerializedName("ALL") 565 ALL, 566 @SerializedName("SPECIFIC") 567 SPECIFIC 568 } 569 570 public static class StockSentCountInfo { 571 @SerializedName("total_count") 572 public Long totalCount; 573 574 @SerializedName("today_count") 575 public Long todayCount; 576 } 577 578 public enum StockState { 579 @SerializedName("AUDITING") 580 AUDITING, 581 @SerializedName("SENDING") 582 SENDING, 583 @SerializedName("PAUSED") 584 PAUSED, 585 @SerializedName("STOPPED") 586 STOPPED, 587 @SerializedName("DEACTIVATED") 588 DEACTIVATED 589 } 590 591 public enum UserProductCouponTag { 592 @SerializedName("MEMBER") 593 MEMBER 594 } 595 596 public static class MemberTagInfo { 597 @SerializedName("member_card_id") 598 public String memberCardId; 599 } 600 601 public enum UserProductCouponUsageDetailItemState { 602 @SerializedName("PENDING") 603 PENDING, 604 @SerializedName("EFFECTIVE") 605 EFFECTIVE, 606 @SerializedName("USED") 607 USED, 608 @SerializedName("EXPIRED") 609 EXPIRED, 610 @SerializedName("DELETED") 611 DELETED, 612 @SerializedName("DEACTIVATED") 613 DEACTIVATED 614 } 615 616 public static class NormalCouponUsageRule { 617 @SerializedName("threshold") 618 public Long threshold; 619 620 @SerializedName("discount_amount") 621 public Long discountAmount; 622 } 623 624 public static class DiscountCouponUsageRule { 625 @SerializedName("threshold") 626 public Long threshold; 627 628 @SerializedName("percent_off") 629 public Long percentOff; 630 } 631 632 public enum SequentialUsageType { 633 @SerializedName("INCREMENTAL") 634 INCREMENTAL, 635 @SerializedName("EQUAL") 636 EQUAL 637 } 638 639 public static class ComboPackage { 640 @SerializedName("name") 641 public String name; 642 643 @SerializedName("pick_count") 644 public Long pickCount; 645 646 @SerializedName("choice_list") 647 public List<ComboPackageChoice> choiceList = new ArrayList<ComboPackageChoice>(); 648 } 649 650 public static class SingleCouponAvailablePeriod { 651 @SerializedName("available_begin_time") 652 public String availableBeginTime; 653 654 @SerializedName("available_end_time") 655 public String availableEndTime; 656 657 @SerializedName("available_days") 658 public Long availableDays; 659 660 @SerializedName("wait_days_after_receive") 661 public Long waitDaysAfterReceive; 662 663 @SerializedName("weekly_available_period") 664 public FixedWeekPeriod weeklyAvailablePeriod; 665 666 @SerializedName("irregular_available_period_list") 667 public List<TimePeriod> irregularAvailablePeriodList; 668 } 669 670 public static class ExchangeCouponUsageRule { 671 @SerializedName("threshold") 672 public Long threshold; 673 674 @SerializedName("exchange_price") 675 public Long exchangePrice; 676 } 677 678 public static class SequentialCouponAvailablePeriod { 679 @SerializedName("available_begin_time") 680 public String availableBeginTime; 681 682 @SerializedName("available_end_time") 683 public String availableEndTime; 684 685 @SerializedName("wait_days_after_receive") 686 public Long waitDaysAfterReceive; 687 688 @SerializedName("weekly_available_period") 689 public FixedWeekPeriod weeklyAvailablePeriod; 690 691 @SerializedName("irregular_available_period_list") 692 public List<TimePeriod> irregularAvailablePeriodList; 693 } 694 695 public enum CouponUsageMethod { 696 @SerializedName("OFFLINE") 697 OFFLINE, 698 @SerializedName("MINI_PROGRAM") 699 MINI_PROGRAM, 700 @SerializedName("APP") 701 APP, 702 @SerializedName("PAYMENT_CODE") 703 PAYMENT_CODE 704 } 705 706 public static class CouponAvailableStoreInfo { 707 @SerializedName("description") 708 public String description; 709 710 @SerializedName("mini_program_appid") 711 public String miniProgramAppid; 712 713 @SerializedName("mini_program_path") 714 public String miniProgramPath; 715 } 716 717 public enum CouponCodeDisplayMode { 718 @SerializedName("INVISIBLE") 719 INVISIBLE, 720 @SerializedName("BARCODE") 721 BARCODE, 722 @SerializedName("QRCODE") 723 QRCODE 724 } 725 726 public static class EntranceMiniProgram { 727 @SerializedName("appid") 728 public String appid; 729 730 @SerializedName("path") 731 public String path; 732 733 @SerializedName("entrance_wording") 734 public String entranceWording; 735 736 @SerializedName("guidance_wording") 737 public String guidanceWording; 738 } 739 740 public static class EntranceOfficialAccount { 741 @SerializedName("appid") 742 public String appid; 743 } 744 745 public static class EntranceFinder { 746 @SerializedName("finder_id") 747 public String finderId; 748 749 @SerializedName("finder_video_id") 750 public String finderVideoId; 751 752 @SerializedName("finder_video_cover_image_url") 753 public String finderVideoCoverImageUrl; 754 } 755 756 public static class ComboPackageChoice { 757 @SerializedName("name") 758 public String name; 759 760 @SerializedName("price") 761 public Long price; 762 763 @SerializedName("count") 764 public Long count; 765 766 @SerializedName("image_url") 767 public String imageUrl; 768 769 @SerializedName("mini_program_appid") 770 public String miniProgramAppid; 771 772 @SerializedName("mini_program_path") 773 public String miniProgramPath; 774 } 775 776 public static class FixedWeekPeriod { 777 @SerializedName("day_list") 778 public List<WeekEnum> dayList; 779 780 @SerializedName("day_period_list") 781 public List<PeriodOfTheDay> dayPeriodList; 782 } 783 784 public static class TimePeriod { 785 @SerializedName("begin_time") 786 public String beginTime; 787 788 @SerializedName("end_time") 789 public String endTime; 790 } 791 792 public enum WeekEnum { 793 @SerializedName("MONDAY") 794 MONDAY, 795 @SerializedName("TUESDAY") 796 TUESDAY, 797 @SerializedName("WEDNESDAY") 798 WEDNESDAY, 799 @SerializedName("THURSDAY") 800 THURSDAY, 801 @SerializedName("FRIDAY") 802 FRIDAY, 803 @SerializedName("SATURDAY") 804 SATURDAY, 805 @SerializedName("SUNDAY") 806 SUNDAY 807 } 808 809 public static class PeriodOfTheDay { 810 @SerializedName("begin_time") 811 public Long beginTime; 812 813 @SerializedName("end_time") 814 public Long endTime; 815 } 816 817} 818
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "demo/wxpay_brand_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/brand/4015826866 5 "encoding/json" 6 "fmt" 7 "net/http" 8 "net/url" 9 "strings" 10 "time" 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 := &GetUserProductCouponRequest{ 28 ProductCouponId: wxpay_brand_utility.String("1002323"), 29 StockId: wxpay_brand_utility.String("100232301"), 30 CouponCode: wxpay_brand_utility.String("123446565767"), 31 Appid: wxpay_brand_utility.String("wx233544546545989"), 32 Openid: wxpay_brand_utility.String("oh-394z-6CGkNoJrsDLTTUKiAnp4"), 33 } 34 35 response, err := GetUserProductCoupon(config, request) 36 if err != nil { 37 fmt.Printf("请求失败: %+v\n", err) 38 // TODO: 请求失败,根据状态码执行不同的处理 39 return 40 } 41 42 // TODO: 请求成功,继续业务逻辑 43 fmt.Printf("请求成功: %+v\n", response) 44} 45 46func GetUserProductCoupon(config *wxpay_brand_utility.BrandConfig, request *GetUserProductCouponRequest) (response *UserProductCouponEntity, err error) { 47 const ( 48 host = "https://api.mch.weixin.qq.com" 49 method = "GET" 50 path = "/brand/marketing/product-coupon/users/{openid}/coupons/{coupon_code}" 51 ) 52 53 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 54 if err != nil { 55 return nil, err 56 } 57 reqUrl.Path = strings.Replace(reqUrl.Path, "{coupon_code}", url.PathEscape(*request.CouponCode), -1) 58 reqUrl.Path = strings.Replace(reqUrl.Path, "{openid}", url.PathEscape(*request.Openid), -1) 59 query := reqUrl.Query() 60 if request.ProductCouponId != nil { 61 query.Add("product_coupon_id", *request.ProductCouponId) 62 } 63 if request.StockId != nil { 64 query.Add("stock_id", *request.StockId) 65 } 66 if request.Appid != nil { 67 query.Add("appid", *request.Appid) 68 } 69 reqUrl.RawQuery = query.Encode() 70 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 71 if err != nil { 72 return nil, err 73 } 74 httpRequest.Header.Set("Accept", "application/json") 75 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 76 authorization, err := wxpay_brand_utility.BuildAuthorization(config.BrandId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 77 if err != nil { 78 return nil, err 79 } 80 httpRequest.Header.Set("Authorization", authorization) 81 82 client := &http.Client{} 83 httpResponse, err := client.Do(httpRequest) 84 if err != nil { 85 return nil, err 86 } 87 respBody, err := wxpay_brand_utility.ExtractResponseBody(httpResponse) 88 if err != nil { 89 return nil, err 90 } 91 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 92 // 2XX 成功,验证应答签名 93 err = wxpay_brand_utility.ValidateResponse( 94 config.WechatPayPublicKeyId(), 95 config.WechatPayPublicKey(), 96 &httpResponse.Header, 97 respBody, 98 ) 99 if err != nil { 100 return nil, err 101 } 102 response := &UserProductCouponEntity{} 103 if err := json.Unmarshal(respBody, response); err != nil { 104 return nil, err 105 } 106 107 return response, nil 108 } else { 109 return nil, wxpay_brand_utility.NewApiException( 110 httpResponse.StatusCode, 111 httpResponse.Header, 112 respBody, 113 ) 114 } 115} 116 117type GetUserProductCouponRequest struct { 118 ProductCouponId *string `json:"product_coupon_id,omitempty"` 119 StockId *string `json:"stock_id,omitempty"` 120 CouponCode *string `json:"coupon_code,omitempty"` 121 Appid *string `json:"appid,omitempty"` 122 Openid *string `json:"openid,omitempty"` 123} 124 125func (o *GetUserProductCouponRequest) MarshalJSON() ([]byte, error) { 126 type Alias GetUserProductCouponRequest 127 a := &struct { 128 ProductCouponId *string `json:"product_coupon_id,omitempty"` 129 StockId *string `json:"stock_id,omitempty"` 130 CouponCode *string `json:"coupon_code,omitempty"` 131 Appid *string `json:"appid,omitempty"` 132 Openid *string `json:"openid,omitempty"` 133 *Alias 134 }{ 135 // 序列化时移除非 Body 字段 136 ProductCouponId: nil, 137 StockId: nil, 138 CouponCode: nil, 139 Appid: nil, 140 Openid: nil, 141 Alias: (*Alias)(o), 142 } 143 return json.Marshal(a) 144} 145 146type UserProductCouponEntity struct { 147 CouponCode *string `json:"coupon_code,omitempty"` 148 CouponState *UserProductCouponState `json:"coupon_state,omitempty"` 149 ValidBeginTime *time.Time `json:"valid_begin_time,omitempty"` 150 ValidEndTime *time.Time `json:"valid_end_time,omitempty"` 151 ReceiveTime *string `json:"receive_time,omitempty"` 152 SendRequestNo *string `json:"send_request_no,omitempty"` 153 SendChannel *UserProductCouponSendChannel `json:"send_channel,omitempty"` 154 ConfirmRequestNo *string `json:"confirm_request_no,omitempty"` 155 ConfirmTime *time.Time `json:"confirm_time,omitempty"` 156 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"` 157 DeactivateTime *string `json:"deactivate_time,omitempty"` 158 DeactivateReason *string `json:"deactivate_reason,omitempty"` 159 SingleUsageDetail *SingleUsageDetail `json:"single_usage_detail,omitempty"` 160 SequentialUsageDetail *SequentialUsageDetail `json:"sequential_usage_detail,omitempty"` 161 ProductCoupon *ProductCouponEntity `json:"product_coupon,omitempty"` 162 Stock *StockEntity `json:"stock,omitempty"` 163 Attach *string `json:"attach,omitempty"` 164 ChannelCustomInfo *string `json:"channel_custom_info,omitempty"` 165 CouponTagInfo *CouponTagInfo `json:"coupon_tag_info,omitempty"` 166} 167 168type UserProductCouponState string 169 170func (e UserProductCouponState) Ptr() *UserProductCouponState { 171 return &e 172} 173 174const ( 175 USERPRODUCTCOUPONSTATE_CONFIRMING UserProductCouponState = "CONFIRMING" 176 USERPRODUCTCOUPONSTATE_PENDING UserProductCouponState = "PENDING" 177 USERPRODUCTCOUPONSTATE_EFFECTIVE UserProductCouponState = "EFFECTIVE" 178 USERPRODUCTCOUPONSTATE_USED UserProductCouponState = "USED" 179 USERPRODUCTCOUPONSTATE_EXPIRED UserProductCouponState = "EXPIRED" 180 USERPRODUCTCOUPONSTATE_DELETED UserProductCouponState = "DELETED" 181 USERPRODUCTCOUPONSTATE_DEACTIVATED UserProductCouponState = "DEACTIVATED" 182) 183 184type UserProductCouponSendChannel string 185 186func (e UserProductCouponSendChannel) Ptr() *UserProductCouponSendChannel { 187 return &e 188} 189 190const ( 191 USERPRODUCTCOUPONSENDCHANNEL_BRAND_MANAGE UserProductCouponSendChannel = "BRAND_MANAGE" 192 USERPRODUCTCOUPONSENDCHANNEL_API UserProductCouponSendChannel = "API" 193 USERPRODUCTCOUPONSENDCHANNEL_RECEIVE_COMPONENT UserProductCouponSendChannel = "RECEIVE_COMPONENT" 194) 195 196type SingleUsageDetail struct { 197 UseRequestNo *string `json:"use_request_no,omitempty"` 198 UseTime *time.Time `json:"use_time,omitempty"` 199 AssociatedOrderInfo *UserProductCouponAssociatedOrderInfo `json:"associated_order_info,omitempty"` 200 ReturnRequestNo *string `json:"return_request_no,omitempty"` 201 ReturnTime *time.Time `json:"return_time,omitempty"` 202} 203 204type SequentialUsageDetail struct { 205 TotalCount *int64 `json:"total_count,omitempty"` 206 UsedCount *int64 `json:"used_count,omitempty"` 207 DetailItemList []SequentialUsageDetailItem `json:"detail_item_list,omitempty"` 208} 209 210type ProductCouponEntity struct { 211 ProductCouponId *string `json:"product_coupon_id,omitempty"` 212 Scope *ProductCouponScope `json:"scope,omitempty"` 213 Type *ProductCouponType `json:"type,omitempty"` 214 UsageMode *UsageMode `json:"usage_mode,omitempty"` 215 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"` 216 SequentialUsageInfo *SequentialUsageInfo `json:"sequential_usage_info,omitempty"` 217 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"` 218 OutProductNo *string `json:"out_product_no,omitempty"` 219 State *ProductCouponState `json:"state,omitempty"` 220 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"` 221 DeactivateTime *string `json:"deactivate_time,omitempty"` 222 DeactivateReason *string `json:"deactivate_reason,omitempty"` 223} 224 225type StockEntity struct { 226 ProductCouponId *string `json:"product_coupon_id,omitempty"` 227 StockId *string `json:"stock_id,omitempty"` 228 Remark *string `json:"remark,omitempty"` 229 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"` 230 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"` 231 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"` 232 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"` 233 SequentialUsageRule *SequentialUsageRule `json:"sequential_usage_rule,omitempty"` 234 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"` 235 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"` 236 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"` 237 StoreScope *StockStoreScope `json:"store_scope,omitempty"` 238 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"` 239 State *StockState `json:"state,omitempty"` 240 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"` 241 DeactivateTime *time.Time `json:"deactivate_time,omitempty"` 242 DeactivateReason *string `json:"deactivate_reason,omitempty"` 243} 244 245type CouponTagInfo struct { 246 CouponTagList []UserProductCouponTag `json:"coupon_tag_list,omitempty"` 247 MemberTagInfo *MemberTagInfo `json:"member_tag_info,omitempty"` 248} 249 250type UserProductCouponAssociatedOrderInfo struct { 251 TransactionId *string `json:"transaction_id,omitempty"` 252 OutTradeNo *string `json:"out_trade_no,omitempty"` 253 Mchid *string `json:"mchid,omitempty"` 254 SubMchid *string `json:"sub_mchid,omitempty"` 255} 256 257type SequentialUsageDetailItem struct { 258 DetailState *UserProductCouponUsageDetailItemState `json:"detail_state,omitempty"` 259 ValidBeginTime *time.Time `json:"valid_begin_time,omitempty"` 260 ValidEndTime *time.Time `json:"valid_end_time,omitempty"` 261 UseRequestNo *string `json:"use_request_no,omitempty"` 262 UseTime *time.Time `json:"use_time,omitempty"` 263 AssociatedOrderInfo *UserProductCouponAssociatedOrderInfo `json:"associated_order_info,omitempty"` 264 ReturnRequestNo *string `json:"return_request_no,omitempty"` 265 ReturnTime *time.Time `json:"return_time,omitempty"` 266 DeleteTime *time.Time `json:"delete_time,omitempty"` 267} 268 269type ProductCouponScope string 270 271func (e ProductCouponScope) Ptr() *ProductCouponScope { 272 return &e 273} 274 275const ( 276 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL" 277 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE" 278) 279 280type ProductCouponType string 281 282func (e ProductCouponType) Ptr() *ProductCouponType { 283 return &e 284} 285 286const ( 287 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL" 288 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT" 289 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE" 290) 291 292type UsageMode string 293 294func (e UsageMode) Ptr() *UsageMode { 295 return &e 296} 297 298const ( 299 USAGEMODE_SINGLE UsageMode = "SINGLE" 300 USAGEMODE_SEQUENTIAL UsageMode = "SEQUENTIAL" 301) 302 303type SingleUsageInfo struct { 304 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"` 305 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"` 306} 307 308type SequentialUsageInfo struct { 309 Type *SequentialUsageType `json:"type,omitempty"` 310 Count *int64 `json:"count,omitempty"` 311 AvailableDays *int64 `json:"available_days,omitempty"` 312 IntervalDays *int64 `json:"interval_days,omitempty"` 313} 314 315type ProductCouponDisplayInfo struct { 316 Name *string `json:"name,omitempty"` 317 ImageUrl *string `json:"image_url,omitempty"` 318 BackgroundUrl *string `json:"background_url,omitempty"` 319 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"` 320 OriginalPrice *int64 `json:"original_price,omitempty"` 321 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"` 322} 323 324type ProductCouponState string 325 326func (e ProductCouponState) Ptr() *ProductCouponState { 327 return &e 328} 329 330const ( 331 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING" 332 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE" 333 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED" 334) 335 336type CouponCodeMode string 337 338func (e CouponCodeMode) Ptr() *CouponCodeMode { 339 return &e 340} 341 342const ( 343 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY" 344 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD" 345 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN" 346) 347 348type CouponCodeCountInfo struct { 349 TotalCount *int64 `json:"total_count,omitempty"` 350 AvailableCount *int64 `json:"available_count,omitempty"` 351} 352 353type StockSendRule struct { 354 MaxCount *int64 `json:"max_count,omitempty"` 355 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"` 356 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"` 357} 358 359type SingleUsageRule struct { 360 CouponAvailablePeriod *SingleCouponAvailablePeriod `json:"coupon_available_period,omitempty"` 361 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"` 362 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"` 363 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"` 364} 365 366type SequentialUsageRule struct { 367 CouponAvailablePeriod *SequentialCouponAvailablePeriod `json:"coupon_available_period,omitempty"` 368 NormalCouponList []NormalCouponUsageRule `json:"normal_coupon_list,omitempty"` 369 DiscountCouponList []DiscountCouponUsageRule `json:"discount_coupon_list,omitempty"` 370 ExchangeCouponList []ExchangeCouponUsageRule `json:"exchange_coupon_list,omitempty"` 371 SpecialFirst *bool `json:"special_first,omitempty"` 372} 373 374type UsageRuleDisplayInfo struct { 375 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"` 376 MiniProgramAppid *string `json:"mini_program_appid,omitempty"` 377 MiniProgramPath *string `json:"mini_program_path,omitempty"` 378 AppPath *string `json:"app_path,omitempty"` 379 UsageDescription *string `json:"usage_description,omitempty"` 380 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"` 381} 382 383type CouponDisplayInfo struct { 384 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"` 385 BackgroundColor *string `json:"background_color,omitempty"` 386 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"` 387 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"` 388 EntranceFinder *EntranceFinder `json:"entrance_finder,omitempty"` 389} 390 391type NotifyConfig struct { 392 NotifyAppid *string `json:"notify_appid,omitempty"` 393} 394 395type StockStoreScope string 396 397func (e StockStoreScope) Ptr() *StockStoreScope { 398 return &e 399} 400 401const ( 402 STOCKSTORESCOPE_NONE StockStoreScope = "NONE" 403 STOCKSTORESCOPE_ALL StockStoreScope = "ALL" 404 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC" 405) 406 407type StockSentCountInfo struct { 408 TotalCount *int64 `json:"total_count,omitempty"` 409 TodayCount *int64 `json:"today_count,omitempty"` 410} 411 412type StockState string 413 414func (e StockState) Ptr() *StockState { 415 return &e 416} 417 418const ( 419 STOCKSTATE_AUDITING StockState = "AUDITING" 420 STOCKSTATE_SENDING StockState = "SENDING" 421 STOCKSTATE_PAUSED StockState = "PAUSED" 422 STOCKSTATE_STOPPED StockState = "STOPPED" 423 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED" 424) 425 426type UserProductCouponTag string 427 428func (e UserProductCouponTag) Ptr() *UserProductCouponTag { 429 return &e 430} 431 432const ( 433 USERPRODUCTCOUPONTAG_MEMBER UserProductCouponTag = "MEMBER" 434) 435 436type MemberTagInfo struct { 437 MemberCardId *string `json:"member_card_id,omitempty"` 438} 439 440type UserProductCouponUsageDetailItemState string 441 442func (e UserProductCouponUsageDetailItemState) Ptr() *UserProductCouponUsageDetailItemState { 443 return &e 444} 445 446const ( 447 USERPRODUCTCOUPONUSAGEDETAILITEMSTATE_PENDING UserProductCouponUsageDetailItemState = "PENDING" 448 USERPRODUCTCOUPONUSAGEDETAILITEMSTATE_EFFECTIVE UserProductCouponUsageDetailItemState = "EFFECTIVE" 449 USERPRODUCTCOUPONUSAGEDETAILITEMSTATE_USED UserProductCouponUsageDetailItemState = "USED" 450 USERPRODUCTCOUPONUSAGEDETAILITEMSTATE_EXPIRED UserProductCouponUsageDetailItemState = "EXPIRED" 451 USERPRODUCTCOUPONUSAGEDETAILITEMSTATE_DELETED UserProductCouponUsageDetailItemState = "DELETED" 452 USERPRODUCTCOUPONUSAGEDETAILITEMSTATE_DEACTIVATED UserProductCouponUsageDetailItemState = "DEACTIVATED" 453) 454 455type NormalCouponUsageRule struct { 456 Threshold *int64 `json:"threshold,omitempty"` 457 DiscountAmount *int64 `json:"discount_amount,omitempty"` 458} 459 460type DiscountCouponUsageRule struct { 461 Threshold *int64 `json:"threshold,omitempty"` 462 PercentOff *int64 `json:"percent_off,omitempty"` 463} 464 465type SequentialUsageType string 466 467func (e SequentialUsageType) Ptr() *SequentialUsageType { 468 return &e 469} 470 471const ( 472 SEQUENTIALUSAGETYPE_INCREMENTAL SequentialUsageType = "INCREMENTAL" 473 SEQUENTIALUSAGETYPE_EQUAL SequentialUsageType = "EQUAL" 474) 475 476type ComboPackage struct { 477 Name *string `json:"name,omitempty"` 478 PickCount *int64 `json:"pick_count,omitempty"` 479 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"` 480} 481 482type SingleCouponAvailablePeriod struct { 483 AvailableBeginTime *string `json:"available_begin_time,omitempty"` 484 AvailableEndTime *string `json:"available_end_time,omitempty"` 485 AvailableDays *int64 `json:"available_days,omitempty"` 486 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"` 487 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"` 488 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"` 489} 490 491type ExchangeCouponUsageRule struct { 492 Threshold *int64 `json:"threshold,omitempty"` 493 ExchangePrice *int64 `json:"exchange_price,omitempty"` 494} 495 496type SequentialCouponAvailablePeriod struct { 497 AvailableBeginTime *string `json:"available_begin_time,omitempty"` 498 AvailableEndTime *string `json:"available_end_time,omitempty"` 499 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"` 500 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"` 501 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"` 502} 503 504type CouponUsageMethod string 505 506func (e CouponUsageMethod) Ptr() *CouponUsageMethod { 507 return &e 508} 509 510const ( 511 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE" 512 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM" 513 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP" 514 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE" 515) 516 517type CouponAvailableStoreInfo struct { 518 Description *string `json:"description,omitempty"` 519 MiniProgramAppid *string `json:"mini_program_appid,omitempty"` 520 MiniProgramPath *string `json:"mini_program_path,omitempty"` 521} 522 523type CouponCodeDisplayMode string 524 525func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode { 526 return &e 527} 528 529const ( 530 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE" 531 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE" 532 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE" 533) 534 535type EntranceMiniProgram struct { 536 Appid *string `json:"appid,omitempty"` 537 Path *string `json:"path,omitempty"` 538 EntranceWording *string `json:"entrance_wording,omitempty"` 539 GuidanceWording *string `json:"guidance_wording,omitempty"` 540} 541 542type EntranceOfficialAccount struct { 543 Appid *string `json:"appid,omitempty"` 544} 545 546type EntranceFinder struct { 547 FinderId *string `json:"finder_id,omitempty"` 548 FinderVideoId *string `json:"finder_video_id,omitempty"` 549 FinderVideoCoverImageUrl *string `json:"finder_video_cover_image_url,omitempty"` 550} 551 552type ComboPackageChoice struct { 553 Name *string `json:"name,omitempty"` 554 Price *int64 `json:"price,omitempty"` 555 Count *int64 `json:"count,omitempty"` 556 ImageUrl *string `json:"image_url,omitempty"` 557 MiniProgramAppid *string `json:"mini_program_appid,omitempty"` 558 MiniProgramPath *string `json:"mini_program_path,omitempty"` 559} 560 561type FixedWeekPeriod struct { 562 DayList []WeekEnum `json:"day_list,omitempty"` 563 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"` 564} 565 566type TimePeriod struct { 567 BeginTime *string `json:"begin_time,omitempty"` 568 EndTime *string `json:"end_time,omitempty"` 569} 570 571type WeekEnum string 572 573func (e WeekEnum) Ptr() *WeekEnum { 574 return &e 575} 576 577const ( 578 WEEKENUM_MONDAY WeekEnum = "MONDAY" 579 WEEKENUM_TUESDAY WeekEnum = "TUESDAY" 580 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY" 581 WEEKENUM_THURSDAY WeekEnum = "THURSDAY" 582 WEEKENUM_FRIDAY WeekEnum = "FRIDAY" 583 WEEKENUM_SATURDAY WeekEnum = "SATURDAY" 584 WEEKENUM_SUNDAY WeekEnum = "SUNDAY" 585) 586 587type PeriodOfTheDay struct { 588 BeginTime *int64 `json:"begin_time,omitempty"` 589 EndTime *int64 `json:"end_time,omitempty"` 590} 591
应答参数
200 OK
coupon_code 必填 string(40)
【用户商品券Code】 用户商品券的唯一标识
coupon_state 必填 string
【用户商品券状态】
可选取值
CONFIRMING: 待确认,用户商品券发放需要品牌方调用确认发放用户商品券接口后才能生效PENDING: 已发放待生效,用户商品券已发放成功但尚未到达可用开始时间EFFECTIVE: 已生效,用户商品券已成功发放且到达可用开始时间USED: 已核销,用户商品券已核销EXPIRED: 已过期,用户商品券已超过有效期,不再可用DELETED: 已删除,用户主动删除该券DEACTIVATED: 已失效,品牌方主动调用失效用户商品券接口使用户商品券失效
valid_begin_time 必填 string
【有效期开始时间】 用户商品券可用开始时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)
valid_end_time 必填 string
【有效期结束时间】 用户商品券可用结束时间。遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)
receive_time 必填 string
【领券时间】 用户领券时间。遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)
send_request_no 必填 string(128)
【发券请求单号】 发券时传入的请求流水号
send_channel 必填 string
【发券渠道】 描述用户商品券是经由什么渠道发送的
可选取值
BRAND_MANAGE: 摇一摇有优惠,通过摇一摇有优惠渠道发放API: 品牌方自主发券,品牌方通过发券接口自主发券到商家名片RECEIVE_COMPONENT: 小程序领券组件,品牌方通过小程序领券组件发券
confirm_request_no 选填 string
【确认请求单号】 品牌方确认发券请求时传入的的请求流水号。当且仅当 品牌方调用确认发放用户商品券接口后提供。
confirm_time 选填 string
【确认发放时间】 品牌方确认发券时间,当且仅当 品牌方调用确认发放用户商品券接口后提供。遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)
deactivate_request_no 选填 string
【失效请求单号】 品牌方失效券请求时传入的的请求流水号。当且仅当 coupon_state 为 DEACTIVATED 时提供。
deactivate_time 选填 string
【失效时间】 失效时间,当且仅当 coupon_state 为 DEACTIVATED 时提供。遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)
deactivate_reason 选填 string
【失效原因】 失效券的原因,当且仅当 coupon_state 为 DEACTIVATED 时提供,返回品牌方调用失效用户商品券接口时传入的失效原因
single_usage_detail 选填 object
【单券使用详情】 当且仅当 usage_mode 为 SINGLE 时提供
| 属性 | |||||
use_request_no 选填 string 【券核销请求单号】 券核销的请求流水号,当且仅当用户商品券状态 use_time 选填 string 【券核销时间】 券被核销的时间,当且仅当用户商品券状态 associated_order_info 选填 object 【券核销的微信支付订单信息】 券核销对应的微信支付订单信息,当且仅当用户商品券状态
return_request_no 选填 string 【退券请求单号】 品牌退券时传入的请求流水号,当且仅当券发生了退回后提供此字段 return_time 选填 string 【退券时间】 券被退回的时间,当且仅当券发生了退回后提供此字段。遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) |
sequential_usage_detail 选填 object
【多次优惠使用详情】 当且仅当 usage_mode 为 SEQUENTIAL 时提供
| 属性 | |||||||||
total_count 必填 integer 【总可使用次数】 本券总计可用次数 used_count 必填 integer 【已使用次数】 当前用户已使用次数 detail_item_list 选填 array[object] 【轮次使用详情列表】 多次优惠中具体每轮使用详情
|
product_coupon 必填 object
【商品券信息】 该用户商品券对应的商品券详情
| 属性 | |||||||||||||||||||||||||||||
product_coupon_id 必填 string(40) 【商品券ID】 商品券的唯一标识,由微信支付生成 scope 必填 string 【优惠范围】 商品券优惠范围 可选取值
type 必填 string 【商品券类型】 商品券的优惠类型 可选取值
usage_mode 必填 string 【使用模式】 商品券使用模式 可选取值
single_usage_info 选填 object 【单券模式信息】 单券模式配置信息,当且仅当
sequential_usage_info 选填 object 【多次优惠模式信息】 多次优惠模式配置信息,当且仅当
display_info 必填 object 【展示信息】 商品券展示信息
out_product_no 选填 string 【外部商品ID】 商户创建商品券时主动传入的外部商品ID,原样返回 state 必填 string 【商品券状态】 商品券状态 可选取值
deactivate_request_no 选填 string 【失效请求单号】 当且仅当 deactivate_time 选填 string 【失效时间】 当且仅当 deactivate_reason 选填 string 【失效原因】 当且仅当 |
stock 必填 object
【批次信息】 该用户商品券发券时使用的批次详情
| 属性 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
product_coupon_id 必填 string(40) 【商品券ID】 商品券的唯一标识,由微信支付生成 stock_id 必填 string(40) 【批次ID】 商品券批次的唯一标识,由微信支付生成 remark 选填 string(20) 【备注】 仅配置品牌可见,用于自定义信息 coupon_code_mode 必填 string 【券Code分配模式】 决定发券时用户商品券Code如何产生 可选取值
coupon_code_count_info 选填 object 【品牌方预上传的券Code数量信息】 当且仅当
stock_send_rule 必填 object 【发放规则】 发放规则
single_usage_rule 选填 object 【单券使用规则】 当且仅当
sequential_usage_rule 选填 object 【多次优惠使用规则】 当且仅当
usage_rule_display_info 必填 object 【券使用规则展示信息】 券使用规则展示信息
coupon_display_info 必填 object 【用户商品券展示信息】 用户商品券在卡包中的展示详情,包括引导用户的自定义入口
notify_config 必填 object 【事件通知配置】 发生券相关事件时,微信支付会向品牌方发送通知,需要提供通知相关配置
store_scope 必填 string 【可用门店范围】 控制该批次可以在品牌下哪些门店使用 可选取值
sent_count_info 必填 object 【已发放次数】 本批次已发放次数
state 必填 string 【批次状态】 商品券批次状态 可选取值
deactivate_request_no 选填 string 【失效请求单号】 当且仅当 deactivate_time 选填 string 【失效时间】 当且仅当 deactivate_reason 选填 string 【失效原因】 当且仅当 |
attach 选填 string
【自定义附加信息】 调用发券接口时品牌方使用 attach 字段主动设置的附加信息。微信支付不会解析该信息,仅在查询用户商品券和回调中原样返回。
注: 发券渠道多样,只有品牌方通过发券接口发放以及通过预发券接口预发放并使用领券组件发放的券才会在查询和回调中携带此字段,其他渠道发放的券 attach 为空。
channel_custom_info 选填 string(1000)
【渠道自定义信息】 使用微信支付提供的其他渠道(比如「摇一摇有优惠」)发放商品券时,渠道可能会设置该渠道特定的自定义信息,请根据 send_channel 字段判断如何解析本字段。不同渠道的自定义信息格式不同,请根据对应渠道的文档解析。
coupon_tag_info 选填 object
【用户商品券标签信息】 用户商品券标签信息
| 属性 | |||||
coupon_tag_list 选填 array[string] 【用户商品券标签列表】 用户商品券标签列表 可选取值
member_tag_info 选填 object 【会员标签信息】 当用户商品券标签列表中有
|
应答示例
200 OK
1{ 2 "coupon_code" : "123446565767", 3 "coupon_state" : "USED", 4 "valid_begin_time" : "2025-01-01T00:00+08:00", 5 "valid_end_time" : "2025-01-30T23:59:59+08:00", 6 "receive_time" : "2025-01-01T09:10:00+08:00", 7 "send_request_no" : "MCHSEND202003101234", 8 "send_channel" : "BRAND_MANAGE", 9 "confirm_request_no" : "MCHCONFIRM202003101234", 10 "confirm_time" : "2025-01-20T13:29:35+08:00", 11 "deactivate_request_no" : "1002600620019090123143254436", 12 "deactivate_time" : "2025-01-20T13:29:35+08:00", 13 "deactivate_reason" : "商品已下线", 14 "single_usage_detail" : { 15 "use_request_no" : "MCHUSE202003101234", 16 "use_time" : "2025-07-20T13:29:35+08:00", 17 "associated_order_info" : { 18 "transaction_id" : "4200000000123456789123456789", 19 "out_trade_no" : "trade_no_20250724123456", 20 "mchid" : "1234567890", 21 "sub_mchid" : "1234567890" 22 }, 23 "return_request_no" : "MCHRETURN202003101234", 24 "return_time" : "2025-07-20T14:29:35+08:00" 25 }, 26 "sequential_usage_detail" : { 27 "total_count" : 10, 28 "used_count" : 3, 29 "detail_item_list" : [ 30 { 31 "detail_state" : "USED", 32 "valid_begin_time" : "2025-07-24T00:00+08:00", 33 "valid_end_time" : "2025-07-30T23:59:59+08:00", 34 "use_request_no" : "MCHUSE202003101234", 35 "use_time" : "2025-07-20T13:29:35+08:00", 36 "associated_order_info" : { 37 "transaction_id" : "4200000000123456789123456789", 38 "out_trade_no" : "trade_no_20250724123456", 39 "mchid" : "1234567890", 40 "sub_mchid" : "1234567890" 41 }, 42 "return_request_no" : "MCHRETURN202003101234", 43 "return_time" : "2025-07-20T14:29:35+08:00", 44 "delete_time" : "2025-07-20T14:29:35+08:00" 45 } 46 ] 47 }, 48 "product_coupon" : { 49 "product_coupon_id" : "1002323", 50 "scope" : "ALL", 51 "type" : "NORMAL", 52 "usage_mode" : "SEQUENTIAL", 53 "single_usage_info" : { 54 "normal_coupon" : { 55 "threshold" : 10000, 56 "discount_amount" : 100 57 }, 58 "discount_coupon" : { 59 "threshold" : 10000, 60 "percent_off" : 30 61 } 62 }, 63 "sequential_usage_info" : { 64 "type" : "EQUAL", 65 "count" : 10, 66 "available_days" : 10, 67 "interval_days" : 1 68 }, 69 "display_info" : { 70 "name" : "全场满100可减10元", 71 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 72 "background_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 73 "detail_image_url_list" : [ 74 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 75 ], 76 "original_price" : 10000, 77 "combo_package_list" : [ 78 { 79 "name" : "咖啡2选1", 80 "pick_count" : 3, 81 "choice_list" : [ 82 { 83 "name" : "美式", 84 "price" : 10000, 85 "count" : 2, 86 "image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx", 87 "mini_program_appid" : "wx4fd12345678", 88 "mini_program_path" : "/pages/index/index" 89 } 90 ] 91 } 92 ] 93 }, 94 "out_product_no" : "Product_1234567890", 95 "state" : "AUDITING", 96 "deactivate_request_no" : "1002600620019090123143254436", 97 "deactivate_time" : "2025-06-20T13:29:35+08:00", 98 "deactivate_reason" : "商品已下架" 99 }, 100 "stock" : { 101 "product_coupon_id" : "200000001", 102 "stock_id" : "123456789", 103 "remark" : "满减券", 104 "coupon_code_mode" : "UPLOAD", 105 "coupon_code_count_info" : { 106 "total_count" : 10000, 107 "available_count" : 999 108 }, 109 "stock_send_rule" : { 110 "max_count" : 10000000, 111 "max_count_per_day" : 10000, 112 "max_count_per_user" : 1 113 }, 114 "single_usage_rule" : { 115 "coupon_available_period" : { 116 "available_begin_time" : "2025-01-01T00:00:00+08:00", 117 "available_end_time" : "2025-10-01T00:00:00+08:00", 118 "available_days" : 10, 119 "wait_days_after_receive" : 1, 120 "weekly_available_period" : { 121 "day_list" : [ 122 "MONDAY" 123 ], 124 "day_period_list" : [ 125 { 126 "begin_time" : 60, 127 "end_time" : 86399 128 } 129 ] 130 }, 131 "irregular_available_period_list" : [ 132 { 133 "begin_time" : "2025-01-01T00:00:00+08:00", 134 "end_time" : "2025-10-01T00:00:00+08:00" 135 } 136 ] 137 }, 138 "normal_coupon" : { 139 "threshold" : 10000, 140 "discount_amount" : 100 141 }, 142 "discount_coupon" : { 143 "threshold" : 10000, 144 "percent_off" : 30 145 }, 146 "exchange_coupon" : { 147 "threshold" : 10000, 148 "exchange_price" : 100 149 } 150 }, 151 "sequential_usage_rule" : { 152 "coupon_available_period" : { 153 "available_begin_time" : "2025-01-01T00:00:00+08:00", 154 "available_end_time" : "2025-10-01T00:00:00+08:00", 155 "wait_days_after_receive" : 1, 156 "weekly_available_period" : { 157 "day_list" : [ 158 "MONDAY" 159 ], 160 "day_period_list" : [ 161 { 162 "begin_time" : 60, 163 "end_time" : 86399 164 } 165 ] 166 }, 167 "irregular_available_period_list" : [ 168 { 169 "begin_time" : "2025-01-01T00:00:00+08:00", 170 "end_time" : "2025-10-01T00:00:00+08:00" 171 } 172 ] 173 }, 174 "normal_coupon_list" : [ 175 { 176 "threshold" : 10000, 177 "discount_amount" : 100 178 } 179 ], 180 "discount_coupon_list" : [ 181 { 182 "threshold" : 10000, 183 "percent_off" : 30 184 } 185 ], 186 "exchange_coupon_list" : [ 187 { 188 "threshold" : 10000, 189 "exchange_price" : 100 190 } 191 ], 192 "special_first" : false 193 }, 194 "usage_rule_display_info" : { 195 "coupon_usage_method_list" : [ 196 "MINI_PROGRAM" 197 ], 198 "mini_program_appid" : "wx1234567890", 199 "mini_program_path" : "/pages/index/product", 200 "app_path" : "https://www.example.com/jump-to-app", 201 "usage_description" : "全场可用", 202 "coupon_available_store_info" : { 203 "description" : "可在上海市区的所有门店使用,详细列表参考小程序内信息为准", 204 "mini_program_appid" : "wx1234567890", 205 "mini_program_path" : "/pages/index/store-list" 206 } 207 }, 208 "coupon_display_info" : { 209 "code_display_mode" : "QRCODE", 210 "background_color" : "Color010", 211 "entrance_mini_program" : { 212 "appid" : "wx1234567890", 213 "path" : "/pages/index/product", 214 "entrance_wording" : "欢迎选购", 215 "guidance_wording" : "获取更多优惠" 216 }, 217 "entrance_official_account" : { 218 "appid" : "wx1234567890" 219 }, 220 "entrance_finder" : { 221 "finder_id" : "gh_12345678", 222 "finder_video_id" : "UDFsdf24df34dD456Hdf34", 223 "finder_video_cover_image_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx" 224 } 225 }, 226 "notify_config" : { 227 "notify_appid" : "wx4fd12345678" 228 }, 229 "store_scope" : "SPECIFIC", 230 "sent_count_info" : { 231 "total_count" : 100, 232 "today_count" : 10 233 }, 234 "state" : "SENDING", 235 "deactivate_request_no" : "1002600620019090123143254436", 236 "deactivate_time" : "2025-01-01T00:00+08:00", 237 "deactivate_reason" : "批次信息有误,重新创建" 238 }, 239 "attach" : "example_attach", 240 "channel_custom_info" : "example_channel_custom_info", 241 "coupon_tag_info" : { 242 "coupon_tag_list" : [ 243 "MEMBER" 244 ], 245 "member_tag_info" : { 246 "member_card_id" : "MemberCardId_1234567890" 247 } 248 } 249} 250
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示
状态码 | 错误码 | 描述 | 解决方案 |
|---|---|---|---|
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 |


