> ## 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.

# 认证状态查询

## 功能说明

认证状态统一通过本接口查询，支持两种场景：

1. **认证申请状态**：按 `merchant_code` + `apply_no` 查询认证申请的处理状态。认证申请为扫码流程，申请状态包含过程细节（待认证、已通过、已驳回等 13 态），平台直接透传机构侧状态；
2. **认证结果**：按 `merchant_code` 查询商户在微信/支付宝侧的认证结果（`auth_status` + 已认证产品码），对应商户认证能力是否可用。

## 请求地址

`POST https://gw.xft.xin/openapi/v1/merchant/auth/query`

## 请求参数

| 字段              | 是否必选 | 字段类型   | 字段说明                                          |
| --------------- | ---- | ------ | --------------------------------------------- |
| `merchant_code` | 是    | String | 平台商户号                                         |
| `apply_no`      | 否    | String | 认证申请号，[认证申请](../auth/apply)接口返回；不传时查询商户整体认证结果 |

## 响应参数

| 字段              | 是否必选 | 字段类型   | 字段说明                                                             |
| --------------- | ---- | ------ | ---------------------------------------------------------------- |
| `merchant_code` | 是    | String | 平台商户号                                                            |
| `apply_no`      | 否    | String | 认证申请号（传入 `apply_no` 查询时返回）                                       |
| `product_code`  | 否    | String | 产品码（传入 `apply_no` 查询时返回）                                         |
| `apply_state`   | 否    | String | 认证申请状态，平台透传机构侧状态（枚举待确认）                                          |
| `auth_status`   | 是    | String | 认证状态（终态口径）：`AUTHORIZED`/`UNAUTHORIZED`/`CLOSED`/`NOTEXIST`，见下方说明 |
| `product_codes` | 否    | Array  | 已认证的产品码列表（不传 `apply_no` 查询时返回）                                   |
| `timestamp`     | 是    | int64  | 状态更新时间，秒级时间戳                                                     |

## 认证状态说明

| 状态             | 说明              |
| -------------- | --------------- |
| `AUTHORIZED`   | 认证通过，对应产品可正常交易  |
| `UNAUTHORIZED` | 未认证（可发起认证申请）    |
| `CLOSED`       | 认证已关闭/注销        |
| `NOTEXIST`     | 机构侧无认证记录（如未申请过） |

<Note>
  认证申请状态字段（`apply_state`）为机构侧原始状态透传，取值以联调为准（字段待确认）。
</Note>

## 示例

**认证申请状态查询**

```json theme={null}
{
  "merchant_code": "M202608150001",
  "apply_no": "AUTH202608150001"
}
```

```json theme={null}
{
  "merchant_code": "M202608150001",
  "apply_no": "AUTH202608150001",
  "product_code": "WECHAT_JSAPI",
  "apply_state": "AUDITING",
  "auth_status": "UNAUTHORIZED",
  "timestamp": 1755330000
}
```

**认证结果查询**

```json theme={null}
{
  "merchant_code": "M202608150001"
}
```

```json theme={null}
{
  "merchant_code": "M202608150001",
  "auth_status": "AUTHORIZED",
  "product_codes": ["WECHAT_JSAPI"],
  "timestamp": 1755336000
}
```

**失败示例**

```json theme={null}
{
  "code": 400,
  "reason": "NOT_FOUND",
  "message": "记录不存在",
  "metadata": {}
}
```

<Note>
  认证状态以本接口为准，扫码后请轮询获取；认证失败（UNAUTHORIZED）可重新发起[认证申请](../auth/apply)。
</Note>
