> ## Documentation Index
> Fetch the complete documentation index at: https://docs.velafi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 确认订单

> 从您的一侧确认订单：将手动支付订单标记为已支付，或完成已支付的出金订单。具体效果取决于 orderType。

调用此端点从您的一侧确认订单。其具体作用取决于 `orderType`，对于 `fiat_to_fiat` 订单还取决于 `direction`（`on_ramp` 或 `off_ramp`），该类型订单必须提供此参数：

| `orderType` | `direction` | 效果 | 接受条件 |
| - | - | - | - |
| `fiat_to_crypto` | — | 在您发送法币后，将订单标记为已支付（`status: 50`）。 | 订单处于 `status: 40` 且使用手动支付方式。如果订单显示 `status: 31`，请先上传所需文件。 |
| `crypto_to_fiat` | — | 完成订单（`status: 60`）。 | 订单处于 `status: 50`。 |
| `fiat_to_fiat` | `on_ramp` | 在您发送法币后，将入金环节标记为已支付。 | 订单处于 `status: 41`，使用手动入金支付方式，尚未被确认，且所需的证明文件均已上传。 |
| `fiat_to_fiat` | `off_ramp` | 无效果；返回 `true`。 | 始终接受。 |

对于 `fiat_to_crypto` 和 `crypto_to_fiat`，操作以订单的实际类型为准。使用自动支付方式的订单由 VelaFi 的银行集成自动转为已支付状态，无法通过此端点标记为已支付。

## 端点

```text theme={null}
POST https://api.velafi.com/v2/order/confirm
```

> [!NOTE]
>
> 沙盒环境测试请使用 `https://api-test.velafi.com/v2/order/confirm`。

## 请求头

| 请求头 | 值 |
| - | - |
| `X-BH-TOKEN` | 通过 `GET /v2/token/generate` 获取的令牌 |
| `Content-Type` | `application/json` |

## 请求体参数

**orderId** `integer` *required*

要确认的订单的唯一数字 ID。

**orderType** `string` *required*

订单类型。必须是 `fiat_to_crypto`、`crypto_to_fiat` 或 `fiat_to_fiat` 之一。

**direction** `string`

仅当 `orderType` 为 `fiat_to_fiat` 时必填。指定要确认的环节：`on_ramp` 或 `off_ramp`。

## 响应字段

**code** `integer`

响应状态码。`200` 表示成功。

**msg** `string`

可读的响应消息。

**data** `boolean`

如果订单确认成功，则为 `true`。

## 示例

> [tab] 加密货币兑法币订单
>
> ```bash theme={null}
> curl -X POST "https://api.velafi.com/v2/order/confirm" \
>   -H "X-BH-TOKEN: YOUR_TOKEN" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "orderId": 1123123123,
>     "orderType": "crypto_to_fiat"
>   }'
> ```
>
> ```json theme={null}
> {
>   "code": 200,
>   "msg": "SUCCESS",
>   "data": true
> }
> ```

> [tab] 法币兑法币订单（入金环节）
>
> ```bash theme={null}
> curl -X POST "https://api.velafi.com/v2/order/confirm" \
>   -H "X-BH-TOKEN: YOUR_TOKEN" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "orderId": 493829236956962817,
>     "orderType": "fiat_to_fiat",
>     "direction": "on_ramp"
>   }'
> ```
>
> ```json theme={null}
> {
>   "code": 200,
>   "msg": "SUCCESS",
>   "data": true
> }
> ```

> [!WARNING]
>
> 不满足上表条件的请求将返回错误。调用此端点前，请先通过 `GET /v2/order/detail` 获取订单当前状态。


## Related topics

- [沙盒环境](https://docs.velafi.com/cn/docs/sandbox.md)
- [错误码](https://docs.velafi.com/cn/docs/error-codes.md)
- [订单状态](https://docs.velafi.com/cn/docs/order-statuses.md)
- [订单事件](https://docs.velafi.com/cn/api-reference/webhooks/fiat-crypto-order-message-push.md)
- [删除收款人](https://docs.velafi.com/cn/api-reference/beneficiary/delete-beneficiary.md)


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