POST/v1/flights/order/cancel/:gdsprovider/:orderId
API 控制台
试一试
向沙箱 API 发送真实请求并查看响应。
凭证
登录后即可从已保存的 API 密钥中选择,无需手动粘贴。
路径参数
2 个字段GDS 提供方
用于获取航班内容的全球分销系统。选择 0 使用默认提供方。
Order ID
创建预订时返回的订单标识符。
请求体
cURL 请求
bash
curl -X POST 'https://api.sandbox.travelandz.com/v1/flights/order/cancel/0/:orderId' \
-H 'Authorization: Bearer YOUR_SECRET_KEY' \
-H 'X-Travelandz-Id: YOUR_PUBLIC_KEY:YOUR_PROFILE_CODE' \
-H 'Content-Type: application/json' \
-d '{"cancelId":"ore_0000B7awtcMBc20FXigs1Z","renewIfExpired":true}'请填写凭证以发送请求。
响应
点击「试一试!」发送请求,响应将显示在此处。
请求取消已有航班订单,可选择使用待确认取消流程返回的 cancelId。
接口
| 方法 | 路径 | 认证 |
|---|---|---|
POST | /v1/flights/order/cancel/:gdsprovider/:orderId | 需要 API key |
| Header | 说明 |
|---|---|
Authorization | Bearer <secret_key>. The secret is shown only once when the credential is created. |
X-Travelandz-Id | <public_key>:<profile_code>. The profile_code is the dp_-prefixed Developer Profile code shown in your dashboard. This binds the request to a profile and credential. |
Content-Type | Use application/json for requests with a body. |
请求参数结构
gdsproviderorderId请求体结构
cancelIdrenewIfExpiredWhen
cancelId is expired, set to true to create and confirm a new pending cancellation automatically.成功响应
返回 the final public cancellation confirmation. Duffel responses include cancellation id, refund summary, confirmation date and liveMode.
响应体结构
messageorderIdcancellationIdPresent for Duffel public cancellations. Omitted in direct provider flows that do not expose a pending cancellation id.
refundrefundtorefundamountrefundcurrencyconfirmedAtPresent for Duffel public cancellations after confirmation.
liveModeTrue when the request is served by the live Travelandz environment. This value comes from Travelandz, not the provider payload.
集成说明
cancelIdis optional. When provided for Duffel, Travelandz fetches and validates that cancellation before confirming it.- If the supplied
cancelIddoes not belong to the providedorderId, the API returns400. - If the supplied
cancelIdis expired andrenewIfExpiredis nottrue, the API returns400. - If the supplied
cancelIdis expired andrenewIfExpired=true, Travelandz creates a new pending cancellation, persists it internally and confirms the new cancellation instead. - If
cancelIdis omitted for Duffel, Travelandz creates, persists and confirms a new pending cancellation automatically. - Direct cancellation can fail when the booking is already ticketing or no longer cancellable.
示例
bash
curl -X POST https://api.sandbox.travelandz.com/v1/flights/order/cancel/0/order_123 \
-H "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
-H "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
-H "Content-Type: application/json" \
-d '{"cancelId":"ore_123","renewIfExpired":true}'请求体 - 示例
json
{
"cancelId": "ore_0000B7awtcMBc20FXigs1Z",
"renewIfExpired": true
}响应
| 状态码 | 说明 |
|---|---|
200 | Flight order canceled successfully. |
400 | 请求无效:payload 不合法。 |
401 | 未授权:凭证无效或缺失。 |
403 | 禁止访问:凭证无效。 |
500 | 服务器内部错误 |
200 响应体
媒体类型:application/json
json
{
"message": "Order canceled successfully",
"orderId": "ord_0000B7aw6DtypHDaOdA5hV",
"cancellationId": "ore_0000B7awtcMBc20FXigs1Z",
"refund": {
"to": "balance",
"amount": "221.89",
"currency": "EUR"
},
"confirmedAt": "2026-06-22T15:50:48.458Z",
"liveMode": false
}