> ## Documentation Index
> Fetch the complete documentation index at: https://opendocs.xft.xin/llms.txt
> Use this file to discover all available pages before exploring further.

# 子商户信息查询

## 功能说明

查询商户在指定支付机构的微信/支付宝子商户信息，包括子商户号、证书地址与功能开通状态。

* 与[认证结果查询](https://opendocs.xft.xin/open/payment/auth/apply-query.md)的区别：本接口查询**子商户开通信息**（子商户号、证书、功能开通状态），认证（授权）申请进度请使用认证结果查询；
* 请求必须同时指定 `merchant_code` 与 `institution_code`，按机构维度查询；
* 仅可查询本主体录入的商户（渠道商可查询旗下品牌录入的商户），否则返回 403 `PERMISSION_DENIED`。

**支持商户**：全部已开通进件权限的渠道商（及其旗下品牌）

**请求方式**：`POST`

**请求路径**：

| 渠道 | 请求路径 |
| - | - |
| 微信 | `POST /openapi/v1/merchant/auth/wechat/info` |
| 支付宝 | `POST /openapi/v1/merchant/auth/alipay/info` |

## 请求参数

| 字段 | 是否必填 | 字段类型 | 字段说明 |
| - | - | - | - |
| `merchant_code` | 是 | String(≤64) | 平台商户号 |
| `institution_code` | 是 | String(≤64) | 支付机构编码，见[支付机构列表](https://opendocs.xft.xin/open/payment/appendix/institutions.md) |

## 响应参数

| 字段 | 是否必填 | 字段类型 | 字段说明 |
| - | - | - | - |
| `sub_merchant_id` | 否 | String | 微信子商户号（`sub_mch_id`）/ 支付宝子商户号（`smid`），未就绪时为空 |
| `cert_url` | 否 | String | 机构侧证书地址，机构未返回时为空 |
| `state` | 是 | String | 功能开通状态：`INACTIVE` / `ACTIVE` / `FAILED` / `PROCESSING` / `CLOSED`；机构未返回时为空串 |
| `func_error_msg` | 否 | String | 功能开通/拆单异常描述，无异常时为空 |

## 开通状态说明

| 状态 | 说明 |
| - | - |
| `INACTIVE` | 未开通 |
| `ACTIVE` | 已开通 |
| `FAILED` | 开通失败 |
| `PROCESSING` | 处理中 |
| `CLOSED` | 已注销 |
| 空串 | 机构未返回或状态值无法识别（平台不透传机构原始码） |

## 示例

**请求（微信子商户信息）**

```json theme={"system"}
{
  "merchant_code": "801292371559190",
  "institution_code": "EASYPAY"
}
```

**响应**

```json theme={"system"}
{
  "sub_merchant_id": "1900000101",
  "cert_url": "https://pay.xft.xin/cert/801292371559190.pem",
  "state": "ACTIVE",
  "func_error_msg": ""
}
```

**失败示例（商户不存在）**

```json theme={"system"}
{
  "code": 400,
  "reason": "NOT_FOUND",
  "message": "商户不存在",
  "metadata": {}
}
```

> [!NOTE]
>
> 子商户号需在机构进件完成后才就绪，未就绪时返回空串；进件进度以[进件状态查询](https://opendocs.xft.xin/open/payment/merchant/apply-query.md)为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.