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

# 商户余额提现申请

## 功能说明

收支平台手动对平台、门店发起提现时，需调用商户余额提现申请接口。

> [!NOTE]
>
> 提现流程：先调用本接口发起提现申请；申请审核通过且冻结余额后，再调用商户余额提现确认接口；提现确认为异步接口，最终结果通过商户余额提现查询接口查询。

## 请求地址

`POST /withdrawal/apply`

## 请求参数

| 字段 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `out_trade_no` | string(64) | 是 | 商户提现申请订单号，业务系统提现时请求唯一流水号 |
| `merchant_code` | string(32) | 是 | 提现商户号 |
| `total_amount` | int(11) | 是 | 提现金额，单位"分" |
| `fee` | int(11) | 否 | 手续费，提现每笔 50 分 |
| `attach` | string(200) | 是 | 提现备注 |
| `notify_url` | string(255) | 否 | 解冻成功后异步通知地址 |

## 请求示例

```json theme={"system"}
{
  "attach": "测试001",
  "currency": "CNY",
  "fee": 0,
  "merchant_code": "226801000000865319122",
  "out_trade_no": "0012b42cdbcb47d5b4b0b1e04d716f34",
  "total_amount": 1
}
```

## 响应参数

| 字段 | 类型 | 说明 |
| - | - | - |
| `out_trade_no` | string | 商户提现申请订单号 |
| `state` | string | 提现状态；`pending` 表示处理中，继续调用提现确认接口；`fail` 表示失败，重新发起提现申请 |
| `merchant_code` | string | 商户号 |
| `total_amount` | int | 提现金额，单位"分" |
| `currency` | string | 币种 |
| `fee` | int | 手续费（V0.0.3 新增字段，表示扣除的手续费金额） |
| `attach` | string | 提现备注 |
| `third_trade_no` | string | 网商银行返回的订单号 |
| `failure_msg` | | 失败原因，失败时返回 |

## 响应示例

```json theme={"system"}
{
  "out_trade_no": "0012b42cdbcb47d5b4b0b1e04d716f34",
  "merchant_code": "226801000000865319122",
  "total_amount": 1,
  "currency": "CNY",
  "fee": 0,
  "attach": "测试001",
  "state": "pending",
  "third_trade_no": "202309120303127366",
  "status": "pending"
}
```

## 代码示例

```java theme={"system"}
XftMybankClient client = new DefaultXftMybankClient(
    "https://xhj-sit.91xft.cn", "111111111111", "xvnYAUWB00jEdIrkdrt5CtQQNB1x4Jhl");
XftWithdrawalApplyRequest request = new XftWithdrawalApplyRequest();
request.setOutTradeNo(StringUtils.getRandomStr());
request.setMerchantCode("226801000000865319122");
request.setCurrency("CNY");
request.setAttach("测试001");
request.setTotalAmount(1);
request.setFee(0);
XftWithdrawalApplyResponse response = client.execute(request);
```


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