确认提现意向
使用此端点,基于创建提现意向中生成的意向完成一笔提现。
这是两步流程中的第二步。金额、收款目标及其余数据已在创建意向时提交并校验,因此这里只需传入幂等键。
可用环境
- 生产环境
https://api.gateway.com.br/core
端点
- 方法:
POST - 端点:
/withdrawal/intent/{id}/confirm - 认证方式:Bearer token
路径参数
| 名称 | 类型 | 必填 | 说明 | 校验规则 |
|---|---|---|---|---|
id | string (UUID) | 是 | 创建提现意向返回的 intentId | 必须为有效的 UUID |
请求体
ℹ️ 每个意向只能用于一笔提现
意向一经确认即被消耗:用同一个 intentId 再次调用会被拒绝。若已超过 5 分钟的有效期,该意向同样不再被接受。
| 名称 | 类型 | 必填 | 说明 | 校验规则 |
|---|---|---|---|---|
idempotencyKey | string | 是 | 用于避免重复的唯一标识 | 长度须在 8 到 255 个字符之间 |
请求示例
- cURL
- JavaScript
curl --request POST \
--url https://api.gateway.com.br/core/withdrawal/intent/553e8400-e29b-41d4-a716-436251480000/confirm \
--header 'Authorization: Bearer your-jwt-token' \
--header 'Content-Type: application/json' \
--data '{
"idempotencyKey": "unique-key-12345"
}'
const response = await fetch('https://api.gateway.com.br/core/withdrawal/intent/553e8400-e29b-41d4-a716-436251480000/confirm', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-jwt-token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
idempotencyKey: 'unique-key-12345',
})
});
const data = await response.json();
成功响应
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string (UUID) | 是 | 提现的唯一标识 |
externalCode | string | 否 | 您的参考编号 |
amount | number | 是 | 提现金额(整数,以分为单位) |
status | string (enum) - PENDING | 是 |
|
响应示例
{
"id": "553e8400-e29b-41d4-a716-436251480001",
"externalCode": "SAQUE-123",
"amount": 10000,
"status": "PENDING"
}
可能的错误
| 状态码 | 说明 | 处理方式 |
|---|---|---|
| 401 | 凭据无效 | 请检查您的凭据 |
| 403 | 无权限或未授权 | 请联系技术支持 |
| 422 | 数据无效或缺失 | 请检查数据格式 |
| 422 | 意向不存在或已过期 | 请重新创建意向后再提交 |
| 422 | 意向已被使用 | 每笔提现都需要创建新的意向 |
| 422 | 校验失败 | 请联系技术支持 |
| 429 | 请求过于频繁 | 请稍后重试 |
| 500 | 内部错误 | 请联系技术支持 |