API Reference

Order Cancellations

To cancel an order, you'll need to create an order cancellation, check the refund_amount returned, and, if you're happy to go ahead and cancel the order.

The refund specified by refund_amount, if any, will be returned to your original payment method (i.e. your Duffel balance). You'll then need to refund your customer (e.g. back to their credit/debit card).

confirmed_at
datetime

The ISO 8601 datetime that indicates when the order cancellation was confirmed

Example: "2020-01-17T11:51:43.114803Z"
created_at
datetime

The ISO 8601 datetime at which the order cancellation was created

Example: "2020-04-11T15:48:11.642Z"
expires_at
datetime

The ISO 8601 datetime by which this cancellation must be confirmed

Example: "2020-01-17T10:42:14.545052Z"
id
string

Duffel's unique identifier for the order cancellation

Example: "orc_001"
live_mode
boolean

Whether the order cancellation was created in live mode. This field will be set to true if the order cancellation was created in live mode, or false if it was created in test mode.

Example: false
order_id
string

Duffel's unique identifier for the order which is being or has been cancelled

Example: "ord_001"
refund_amount
string

The amount that will be returned to the original payment method if the order is cancelled, determined according to the fare conditions. This may be 0.00 if the fare is non-refundable. It will include the refund amount of the flights and the services booked.

Example: "90.80"
refund_currency
string

The currency of the refund_amount, as an ISO 4217 currency code. It will match your organisation's billing currency unless you’re using Duffel as an accredited IATA agent, in which case it will be in the currency provided by the airline (which will usually be based on the country where your IATA agency is registered). For pay later orders that are awaiting payment, the refund amount will always be 0.00.

Example: "GBP"
refund_to
enum

Where the refund, once confirmed, will be sent. card is currently a restricted feature. awaiting_payment is for pay later orders where no payment has been made yet.

Possible values: "arc_bsp_cash", "balance", "card", "voucher", or "awaiting_payment"

To begin the process of cancelling an order you need to create an order cancellation. The OrderCancellation will contain the refund_amount due from the Airline.

To proceed, you must confirm the cancellation using the Confirm an order cancellation endpoint.

Endpoint

POSThttps://api.duffel.com/air/order_cancellations

Body parameters

order_id
string
required

Duffel's unique identifier for the order

Example: "ord_001"

Request example

curl -X POST --compressed "https://api.duffel.com/air/order_cancellations" \
-H "Accept-Encoding: gzip" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Duffel-Version: beta" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-d '{
"data": {
"order_id": "ord_001"
}
}'

Response example

{
"data": {
"refund_to": "arc_bsp_cash",
"refund_currency": "GBP",
"refund_amount": "90.80",
"order_id": "ord_001",
"live_mode": false,
"id": "orc_001",
"expires_at": "2020-01-17T10:42:14.545052Z",
"created_at": "2020-04-11T15:48:11.642Z",
"confirmed_at": "2020-01-17T11:51:43.114803Z"
}
}

Once you've created a pending order cancellation, you'll know the refund_amount you're due to get back.

To actually cancel the order, you'll need to confirm the cancellation. The booking with the airline will be cancelled, and the refund_amount will be returned to the original payment method (i.e. your Duffel balance). You'll then need to refund your customer (e.g. back to their credit/debit card).

Endpoint

POSThttps://api.duffel.com/air/order_cancellations/{id}/actions/confirm

URL parameters

id
string
required

Duffel's unique identifier for the order cancellation

Example: "orc_001"

Request example

curl -X POST --compressed "https://api.duffel.com/air/order_cancellations/{id}/actions/confirm" \
-H "Accept-Encoding: gzip" \
-H "Accept: application/json" \
-H "Duffel-Version: beta" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"

Response example

{
"data": {
"refund_to": "arc_bsp_cash",
"refund_currency": "GBP",
"refund_amount": "90.80",
"order_id": "ord_001",
"live_mode": false,
"id": "orc_001",
"expires_at": "2020-01-17T10:42:14.545052Z",
"created_at": "2020-04-11T15:48:11.642Z",
"confirmed_at": "2020-01-17T11:51:43.114803Z"
}
}