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

# 商户余额明细查询

## 功能说明

收支平台通过商户号查询余额明细，同门店交易明细查询（包含门店消费入金、分账、提现明细数据）。

## 请求地址

`POST /balance/detail`

## 请求参数

| 字段              | 类型         | 必填 | 说明                                                                                     |
| --------------- | ---------- | -- | -------------------------------------------------------------------------------------- |
| `merchant_code` | string(32) | 否  | 商户号                                                                                    |
| `begin_date`    | string(32) | 否  | 查询开始时间，格式 `yyyy-MM-dd HH:mm:ss`                                                        |
| `end_date`      | string(32) | 否  | 查询结束时间，格式 `yyyy-MM-dd HH:mm:ss`                                                        |
| `page_no`       | int        | 否  | 页码，默认 1                                                                                |
| `page_size`     | int        | 否  | 每页数量，默认 20                                                                             |
| `in_out_type`   | string(1)  | 否  | 收支类型；`0` 入金；`1` 出金                                                                     |
| `types`         | string(1)  | 否  | 交易类型；`1` 提现、`2` 分账、`3` 收款、`4` 退款、`5` 分账手续费、`6` 提现手续费（5、6 为 V0.0.3 新增字段，表示分账、提现手续费变动类型） |
| `contract_no`   | string(32) | 否  | 合同编码                                                                                   |

## 请求示例

```json theme={null}
{
  "merchant_code": "226801000000865319122",
  "begin_date": "2023-09-01 00:00:00",
  "end_date": "2023-09-30 23:59:59",
  "page_no": 1,
  "page_size": 20
}
```

## 响应参数

| 字段                                 | 类型     | 说明                                                                                     |
| ---------------------------------- | ------ | -------------------------------------------------------------------------------------- |
| `pages`                            | int    | 总页数                                                                                    |
| `current`                          | int    | 当前页码                                                                                   |
| `total`                            | int    | 总记录条数                                                                                  |
| `size`                             | int    | 当前每页条数                                                                                 |
| `records`                          | object | 商户余额明细信息                                                                               |
| `records.merchant_code`            | string | 平台分配的商户号                                                                               |
| `records.id`                       | int    | 余额流水号，商户余额明细流 id                                                                       |
| `records.in_out_type`              | string | 收支类型；`0` 入金；`1` 出金                                                                     |
| `records.other_side_merchant_code` | string | 对方商户号；入金则展示付款商户号，出金则展示收款商户号                                                            |
| `records.amount`                   | int    | 变动金额，账户收支变动金额，单位分                                                                      |
| `records.types`                    | string | 交易类型；`1` 提现、`2` 分账、`3` 收款、`4` 退款、`5` 分账手续费、`6` 提现手续费（5、6 为 V0.0.3 新增字段，表示分账、提现手续费变动类型） |
| `records.created_at`               | string | 余额变动时间，余额变动记账时间，格式 `yyyy-MM-dd HH:mm:ss`                                               |
| `records.contract_no`              | string | 合同编码                                                                                   |
| `records.trade_no`                 | string | 支付流水，支付流水号/分账流水号/提现流水号/退款流水号                                                           |

## 响应示例

```json theme={null}
{
  "pages": 1,
  "current": 1,
  "total": 1,
  "size": 20,
  "records": [
    {
      "merchant_code": "226801000000865319122",
      "id": 1,
      "in_out_type": "0",
      "other_side_merchant_code": "226801000000868445122",
      "amount": 100,
      "types": "3",
      "created_at": "2023-09-12 15:30:00",
      "contract_no": "HT202309120001",
      "trade_no": "202309120303127366"
    }
  ]
}
```
