查询品牌门店

更新时间:2025.08.04

根据品牌门店ID,查询品牌门店。

接口说明

支持商户:【普通服务商】

请求方式:【GET】/v3/brand/partner/store/brandstores/{store_id}

请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点

     【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看

请求参数

Header  HTTP头参数

 Authorization  必填 string

请参考签名认证生成认证信息


 Accept  必填 string

请设置为application/json


path  路径参数

 store_id  必填   string

【品牌门店ID】 创建品牌门店后,系统为该门店分配的唯一ID。


query  查询参数

 brand_id  必填   string

【品牌ID】 商家进驻微信支付品牌商家后获得的品牌ID。

请求示例

Java
Go
curl

需配合微信支付工具库 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 GetBrandStore {
26  private static String HOST = "https://api.mch.weixin.qq.com";
27  private static String METHOD = "GET";
28  private static String PATH = "/v3/brand/partner/store/brandstores/{store_id}";
29
30  public static void main(String[] args) {
31    // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340
32    GetBrandStore client = new GetBrandStore(
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    GetBrandStoreRequest request = new GetBrandStoreRequest();
41    request.storeId = "1234567890123456";
42    request.brandId = "123456789";
43    try {
44      BrandStoresEntity response = client.run(request);
45
46      // TODO: 请求成功,继续业务逻辑
47      System.out.println(response);
48    } catch (WXPayUtility.ApiException e) {
49      // TODO: 请求失败,根据状态码执行不同的逻辑
50      e.printStackTrace();
51    }
52  }
53
54  public BrandStoresEntity run(GetBrandStoreRequest request) {
55    String uri = PATH;
56    uri = uri.replace("{store_id}", WXPayUtility.urlEncode(request.storeId));
57    Map<String, Object> args = new HashMap<>();
58    args.put("brand_id", request.brandId);
59    uri = uri + "?" + WXPayUtility.urlEncode(args);
60
61    Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
62    reqBuilder.addHeader("Accept", "application/json");
63    reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId);
64    reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null));
65    reqBuilder.method(METHOD, null);
66    Request httpRequest = reqBuilder.build();
67
68    // 发送HTTP请求
69    OkHttpClient client = new OkHttpClient.Builder().build();
70    try (Response httpResponse = client.newCall(httpRequest).execute()) {
71      String respBody = WXPayUtility.extractBody(httpResponse);
72      if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
73        // 2XX 成功,验证应答签名
74        WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey,
75            httpResponse.headers(), respBody);
76
77        // 从HTTP应答报文构建返回数据
78        return WXPayUtility.fromJson(respBody, BrandStoresEntity.class);
79      } else {
80        throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
81      }
82    } catch (IOException e) {
83      throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
84    }
85  }
86
87  private final String mchid;
88  private final String certificateSerialNo;
89  private final PrivateKey privateKey;
90  private final String wechatPayPublicKeyId;
91  private final PublicKey wechatPayPublicKey;
92
93  public GetBrandStore(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) {
94    this.mchid = mchid;
95    this.certificateSerialNo = certificateSerialNo;
96    this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath);
97    this.wechatPayPublicKeyId = wechatPayPublicKeyId;
98    this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath);
99  }
100
101  public static class GetBrandStoreRequest {
102    @SerializedName("brand_id")
103    @Expose(serialize = false)
104    public String brandId;
105  
106    @SerializedName("store_id")
107    @Expose(serialize = false)
108    public String storeId;
109  }
110  
111  public static class BrandStoresEntity {
112    @SerializedName("brand_id")
113    public String brandId;
114  
115    @SerializedName("store_id")
116    public String storeId;
117  
118    @SerializedName("store_state")
119    public StoreState storeState;
120  
121    @SerializedName("audit_state")
122    public AuditState auditState;
123  
124    @SerializedName("review_reject_reason")
125    public String reviewRejectReason;
126  
127    @SerializedName("store_basics")
128    public StoreBase storeBasics;
129  
130    @SerializedName("store_address")
131    public StoreLocation storeAddress;
132  
133    @SerializedName("store_business")
134    public StoreBusiness storeBusiness;
135  
136    @SerializedName("store_recipient")
137    public List<StoreRecipient> storeRecipient;
138  }
139  
140  public enum StoreState {
141    @SerializedName("OPEN")
142    OPEN,
143    @SerializedName("CREATING")
144    CREATING,
145    @SerializedName("CLOSED")
146    CLOSED
147  }
148  
149  public enum AuditState {
150    @SerializedName("SUCCESS")
151    SUCCESS,
152    @SerializedName("PROCESSING")
153    PROCESSING,
154    @SerializedName("REJECTED")
155    REJECTED
156  }
157  
158  public static class StoreBase {
159    @SerializedName("store_reference_id")
160    public String storeReferenceId;
161  
162    @SerializedName("branch_name")
163    public String branchName;
164  }
165  
166  public static class StoreLocation {
167    @SerializedName("address_code")
168    public String addressCode;
169  
170    @SerializedName("address_detail")
171    public String addressDetail;
172  
173    @SerializedName("address_complements")
174    public String addressComplements;
175  
176    @SerializedName("longitude")
177    public String longitude;
178  
179    @SerializedName("latitude")
180    public String latitude;
181  }
182  
183  public static class StoreBusiness {
184    @SerializedName("service_phone")
185    public String servicePhone;
186  
187    @SerializedName("business_hours")
188    public String businessHours;
189  }
190  
191  public static class StoreRecipient {
192    @SerializedName("mchid")
193    public String mchid;
194  
195    @SerializedName("company_name")
196    public String companyName;
197  
198    @SerializedName("recipient_state")
199    public RecipientState recipientState;
200  }
201  
202  public enum RecipientState {
203    @SerializedName("CONFIRMED")
204    CONFIRMED,
205    @SerializedName("ADMIN_REJECTED")
206    ADMIN_REJECTED,
207    @SerializedName("CONFIRMING")
208    CONFIRMING,
209    @SerializedName("TIMEOUT_REJECTED")
210    TIMEOUT_REJECTED
211  }
212  
213}
214

应答参数

200 OK

 brand_id  必填   string

【品牌ID】 商家进驻微信支付品牌商家后获得的品牌ID。


 store_id  选填   string

【品牌门店ID】 创建品牌门店后,系统为该门店分配的唯一ID。


 store_state  选填   string

【门店状态】 用于描述门店当前状态

可选取值

  • OPEN:  门店营业中。

  • CREATING:  门店创建中。在创建门店后,门店资料正在审核。审核详情请查看审核状态。

  • CLOSED:  门店已停业。不可用于微信支付生态中的其他业务,可删除该门店,删除后将无法恢复,请谨慎操作。


 audit_state  选填   string

【审核状态】 创建、修改门店时,通过此字段可得知当前审核状态

可选取值

  • SUCCESS:  门店资料审核通过

  • PROCESSING:  门店资料审核中

  • REJECTED:  门店资料被驳回,请根据驳回原因进行修改。


 review_reject_reason  选填   string

【审核失败原因】 门店资料审核失败的原因


 store_basics  选填   object

【门店基础信息】 用于描述门店编码,名称等基本情况。

属性

 store_address  选填   object

【门店地址信息】 用于描述门店地址,经纬度等地理位置相关情况。

属性

 store_business  选填   object

【门店经营信息】 用于描述门店联系电话,经营时间等经营状况。

属性

 store_recipient  选填   array[object]

【门店收款信息】 门店收款商户列表。

属性

应答示例

200 OK

1{
2  "brand_id" : "123456789",
3  "store_id" : "1234567890123456",
4  "store_state" : "OPEN",
5  "audit_state" : "SUCCESS",
6  "review_reject_reason" : "通过核实,您提交的电话错误,请核实手机号码或座机号码是否正确",
7  "store_basics" : {
8    "store_reference_id" : "MDL001",
9    "branch_name" : "海岸城店"
10  },
11  "store_address" : {
12    "address_code" : "440305",
13    "address_detail" : "深南大道10000号腾讯大厦1楼",
14    "address_complements" : "地铁A口右侧100米",
15    "longitude" : "112.63484",
16    "latitude" : "37.75464"
17  },
18  "store_business" : {
19    "service_phone" : "0755-86013388",
20    "business_hours" : "周一至周五 09:00-20:00"
21  },
22  "store_recipient" : [
23    {
24      "mchid" : "1230000109",
25      "company_name" : "腾讯科技(深圳)有限公司",
26      "recipient_state" : "CONFIRMED"
27    }
28  ]
29}
30

 

错误码

公共错误码

状态码

错误码

描述

解决方案

400

PARAM_ERROR

参数错误

请根据错误提示正确传入参数

400

INVALID_REQUEST

HTTP 请求不符合微信支付 APIv3 接口规则

请参阅 接口规则

401

SIGN_ERROR

验证不通过

请参阅 签名常见问题

500

SYSTEM_ERROR

系统异常,请稍后重试

请稍后重试

 

更多技术问题
技术咨询
反馈
咨询
目录
置顶