POST/v1/flights/order/cancel/:gdsprovider/:orderId

取消航班订单

请求取消已有航班订单,可选择使用待确认取消流程返回的 cancelId。

分享
POST/v1/flights/order/cancel/:gdsprovider/:orderId

API 控制台

试一试

向沙箱 API 发送真实请求并查看响应。

凭证

登录后即可从已保存的 API 密钥中选择,无需手动粘贴。

路径参数

2 个字段

GDS 提供方

用于获取航班内容的全球分销系统。选择 0 使用默认提供方。

Order ID

创建预订时返回的订单标识符。

请求体

cURL 请求

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说明
AuthorizationBearer <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-TypeUse application/json for requests with a body.

请求参数结构

gdsprovider
number
orderId
string

请求体结构

cancelId
string
renewIfExpired
boolean
When 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.

响应体结构

message
string
orderId
string
cancellationId
string
Present for Duffel public cancellations. Omitted in direct provider flows that do not expose a pending cancellation id.
refund
object
refundto
string
refundamount
string
refundcurrency
string
confirmedAt
string
Format: ISO 8601
Present for Duffel public cancellations after confirmation.
liveMode
boolean
True when the request is served by the live Travelandz environment. This value comes from Travelandz, not the provider payload.

集成说明

  • cancelId is optional. When provided for Duffel, Travelandz fetches and validates that cancellation before confirming it.
  • If the supplied cancelId does not belong to the provided orderId, the API returns 400.
  • If the supplied cancelId is expired and renewIfExpired is not true, the API returns 400.
  • If the supplied cancelId is expired and renewIfExpired=true, Travelandz creates a new pending cancellation, persists it internally and confirms the new cancellation instead.
  • If cancelId is 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
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
json
{
  "cancelId": "ore_0000B7awtcMBc20FXigs1Z",
  "renewIfExpired": true
}

响应

状态码说明
200Flight order canceled successfully.
400请求无效:payload 不合法。
401未授权:凭证无效或缺失。
403禁止访问:凭证无效。
500服务器内部错误

200 响应体

媒体类型:application/json

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
}