Implementation Guides

Cancelling an order

caution

Order cancellation is not yet supported for all airlines. In the future we plan to surface in the API whether that's possible or not. For now, cancelling an order of an airline that does not support this operation will result in a not_implemented error.

What do you need to start?

All you need to get started with a cancellation is the id of the order you'd like to cancel. If you still haven't learned how to create an order, head over to our quick start.

Overview

The order cancellation process happens in 3 steps:

  • You request a cancellation refund quote

  • You confirm your cancellation

  • You validate your order was cancelled

Request Cancellation Refund Quote

Before you actually cancel an order, we give you the ability to see what your refund would be. We call this step "requesting a cancellation". Using the id of the order you'd like to cancel, request the cancellation to receive the refund amount you'd get back when the order is cancelled.

Curl

1
curl -X POST --compressed "https://api.duffel.com/air/order_cancellations" \
2
-H "Accept-Encoding: gzip" \
3
-H "Accept: application/json" \
4
-H "Content-Type: application/json" \
5
-H "Duffel-Version: beta" \
6
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
7
-d '{
8
"data": {
9
"order_id": "ord_001"
10
}
11
}'
12

Before you actually cancel an order, we give you the ability to see what your refund would be. We call this step "requesting a cancellation". Using the id of the order you'd like to cancel, request the cancellation to receive the refund amount you'd get back when the order is cancelled.

{
// we'll use the id on the next step
"id": "orc_001",
// determine whether you want to continue with the
// cancellation or not based on the refund amount
"refund_currency": "GBP",
"refund_amount": "90.80",
// if this timestamp is in the past you will
// not be able to confirm your cancellation
// and will need to re-request a cancellation quote
"expires_at": "2020-01-17T10:42:14.545052Z",
...
}

For a complete schema of the order cancellation object please refer to our api reference

Confirm Cancellation

Before you actually cancel an order, we give you the ability to see what your refund would be. We call this step "requesting a cancellation". Using the id of the order you'd like to cancel, request the cancellation to receive the refund amount you'd get back when the order is cancelled.

Curl

1
curl -X POST --compressed "https://api.duffel.com/air/order_cancellations/<ID>/actions/confirm" \
2
-H "Accept-Encoding: gzip" \
3
-H "Accept: application/json" \
4
-H "Duffel-Version: beta" \
5
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
6

Validate Cancellation

Before you actually cancel an order, we give you the ability to see what your refund would be. We call this step "requesting a cancellation". Using the id of the order you'd like to cancel, request the cancellation to receive the refund amount you'd get back when the order is cancelled.

Curl

1
curl -X GET --compressed "https://api.duffel.com/air/orders/<ID>" \
2
-H "Accept-Encoding: gzip" \
3
-H "Accept: application/json" \
4
-H "Duffel-Version: beta" \
5
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
6

Keep Learning

This is it! That's how you cancel an order. To get a complete look at this flow in our API reference you can jump to:

If you haven't learned how to add extra bags to your bookings, we recommend looking at that next: