> ## 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 /profit/sharing/orders`

### 请求参数

| 字段                               | 类型        | 必填 | 长度  | 说明                 |
| -------------------------------- | --------- | -- | --- | ------------------ |
| `out_trade_no`                   | string    | 是  | 64  | 分账订单号，即本次分账的业务请求流水 |
| `contract_no`                    | string    | 是  | 64  | 合同编号               |
| `merchant_code`                  | string    | 是  | 32  | 分账付款方商户号           |
| `total_amount`                   | int       | 是  | 8   | 本次分账总金额，单位：分       |
| `receiver_infos`                 | object\[] | 是  | -   | 分账接收方列表            |
| `receiver_infos[].merchant_code` | string    | 是  | 32  | 接收方商户号             |
| `receiver_infos[].sub_trade_no`  | string    | 是  | 64  | 分账子单业务流水号          |
| `receiver_infos[].amount`        | int       | 是  | 8   | 该接收方的分账金额，单位：分     |
| `receiver_infos[].attach`        | string    | 是  | 128 | 分账子单备注             |
| `attach`                         | string    | 否  | 128 | 分账订单备注             |

### 请求示例

```json theme={null}
{
  "out_trade_no": "b6df8ca277f845bb80796f4f78a614db",
  "contract_no": "1111111111",
  "merchant_code": "226801000000865319122",
  "total_amount": 2,
  "attach": "测试001",
  "receiver_infos": [
    {
      "merchant_code": "226801000000868445122",
      "sub_trade_no": "0f0fc152f209468d94bf93e0acaaaeea",
      "amount": 1,
      "attach": "测试001"
    },
    {
      "merchant_code": "226801000000868445122",
      "sub_trade_no": "bb42ea8ac4b3499c84bd689c5c8fb0a7",
      "amount": 1,
      "attach": "测试001"
    }
  ]
}
```

### 响应参数

| 字段                                | 类型        | 说明                                                       |
| --------------------------------- | --------- | -------------------------------------------------------- |
| `out_trade_no`                    | string    | 分账订单号                                                    |
| `contract_no`                     | string    | 合同编号                                                     |
| `merchant_code`                   | string    | 分账付款方商户号                                                 |
| `total_amount`                    | int       | 分账总金额，单位：分                                               |
| `attach`                          | string    | 分账订单备注                                                   |
| `failure_code`                    | string    | 失败原因编码；仅订单状态异常时可能返回                                      |
| `failure_msg`                     | string    | 失败原因描述；仅订单状态异常时可能返回                                      |
| `state`                           | string    | 订单状态。原文定义：`00` 为成功，`01` 为失败；示例中子单还可能为 `pending`，应以查询结果为准 |
| `receiver_infos`                  | object\[] | 分账接收方结果列表                                                |
| `receiver_infos[].merchant_code`  | string    | 接收方商户号                                                   |
| `receiver_infos[].sub_trade_no`   | string    | 分账子单订单号                                                  |
| `receiver_infos[].third_trade_no` | string    | 网商流水号                                                    |
| `receiver_infos[].amount`         | int       | 已成功分账金额，单位：分；原文说明失败子单可能不返回金额                             |
| `receiver_infos[].fee`            | int       | 分账手续费，单位：分（文档版本 `V0.0.3` 新增）                             |
| `receiver_infos[].attach`         | string    | 分账子单备注                                                   |
| `receiver_infos[].state`          | string    | 子单处理状态                                                   |

```json theme={null}
{
  "out_trade_no": "b6df8ca277f845bb80796f4f78a614db",
  "contract_no": "1111111111",
  "merchant_code": "226801000000865319122",
  "total_amount": 2,
  "attach": "测试001",
  "receiver_infos": [
    {
      "sub_trade_no": "0f0fc152f209468d94bf93e0acaaaeea",
      "third_trade_no": null,
      "merchant_code": "226801000000868445122",
      "amount": 1,
      "attach": "测试001",
      "state": "pending"
    }
  ]
}
```
