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

# 扫码设备获取商户信息接口

## 功能说明

根据收银设备 SN 和厂商编号获取对应的商户信息，包括商户编号、商户名称、员工信息及密钥等。

## 请求地址

`POST /v1/aggregate/merchant/get`

## 请求参数

| 字段            | 类型     | 必填 | 说明      |
| ------------- | ------ | -- | ------- |
| `sn`          | string | 是  | 收银设备 SN |
| `vendor_code` | string | 是  | 厂商编号    |

## 请求示例

```json theme={null}
{
  "sn": "SN123456789",
  "vendor_code": "V001"
}
```

## 响应参数

| 字段              | 类型     | 说明                                                       |
| --------------- | ------ | -------------------------------------------------------- |
| `merchant_code` | string | 商户编号                                                     |
| `merchant_name` | string | 商户名称                                                     |
| `staff_code`    | string | 员工编号                                                     |
| `staff_name`    | string | 员工名称                                                     |
| `app_key`       | string | app\_key                                                 |
| `app_secret`    | string | app\_secret，使用 SM4-CTR 加密后 Base64 编码返回，设备端用 `app_key` 解密 |

<Note>
  `app_secret` 的加密方式说明：

  * 加密算法：SM4-CTR
  * 密钥派生：`HMAC-SHA256(app_key, "sm4ctr-key")[:16]`
  * IV 派生：`HMAC-SHA256(app_key, "sm4ctr-iv")[:16]`
</Note>

## 响应示例

```json theme={null}
{
  "merchant_code": "226801000000865319122",
  "merchant_name": "示例商户",
  "staff_code": "STAFF001",
  "staff_name": "张三",
  "app_key": "ak_example_key",
  "app_secret": "Base64EncodedSM4CTREncryptedValue=="
}
```
