Offer and Order Conditions
Overview
conditions
attributes returned in the Offers and Orders APIs you're already using.What do you need to start?
Setting the context
What are offers and orders?
Taking a direct flight with British Airways
Taking a connecting flight with Iberia via Madrid
Taking a connecting flight with Lufthansa via Munich

Airlines provide different offers to fly from London to Ibiza

Airlines can offer multiple options for exactly the same flight(s)
What do airlines mean by "changes" and "refunds"?

A round-trip from London to Ibiza with Duffel Airways, departing on 4th June and returning on 11th June
Request a refund: If my order allows me to refund before departure, then I can get my money back. If there's a penalty, that will be subtracted from the money that is refunded.
Postpone my outbound flight by a few days, but keep the inbound flight the same: If my outbound slice allows me to change before departure, then I can change that slice, pushing it back by a couple of days. I will have to pay the "fare difference" if my new flights are more expensive than the old ones. If there's a penalty, I'll also have to pay that to process the change.
Postpone my whole trip by two weeks: If my order as a whole allows me to change before departure, then I can change both slices, pushing them back by two weeks. I will have to pay any extra amount if my new flights are more expensive than the old ones. If there's a penalty, I'll also have to pay that to process the change.
Cancel both flights and pick new ones later: If my order as a whole allows me to change before departure, then I can cancel these flights and wait until later to decide my next steps. Later in the year, I can come back and pick my new dates, and at that point, I'll pay any extra amount for the flights plus any penalty that applies.
What information is available in the Duffel API?
conditions
attribute is available on offers and orders - in other words, before and after a customer makes a booking. Inside it, there can be two different types of condition: change_before_departure
and refund_before_departure
.tip
We don't return refund conditions at the slice level because it isn't possible to refund one slice in an order with multiple slices. The airline thinks of that as a change, because there are still flights left over.
a boolean telling you whether it's
allowed
the
penalty_amount
andpenalty_currency
of any penalty that applies - if we know it
null
. This doesn't mean that changing or refunding isn't possible, or that there's no fee. It just means that we don't know.Worked examples
conditions
could look.Refunds are not allowed
conditions.refund_before_departure.allowed
attribute will be false
, and the penalty amount and currency will be null
:React
{"id": "off_123",// ..."conditions": {"refund_before_departure": {"allowed": false,"penalty_amount": null,"penalty_currency": null},// ...}}
Refunds are allowed free of charge
conditions.refund_before_departure.allowed
attribute on the offer or order will be true
with a zero penalty amount:React
{"id": "off_123",// ..."conditions": {"refund_before_departure": {"allowed": true,"penalty_amount": "0.00","penalty_currency": "GBP"},// ...}}
Refunds are allowed, but with a penalty
conditions.refund_before_departure.allowed
attribute on the offer or order will be true
with a non-zero amount:React
{"id": "off_123",// ..."conditions": {"refund_before_departure": {"allowed": true,"penalty_amount": "200.00","penalty_currency": "GBP"},// ...}}
200 GBP
penalty will be subtracted from any refund.caution
The penalty_currency
will not always match the currency of the offer or order (that is, its total_currency
). Where this is the case, the penalty will be converted into the currency you're paying in at the time that you process any change or refund, using the current exchange rate. This can happen if the airline provided the price in a different currency and Duffel is converting it into your chosen currency.
Changes are not allowed for any of the flights
conditions.change_before_departure.allowed
attribute at the top level will be false
, and the penalty amount and currency will be null
:React
{"id": "off_123",// ..."conditions": {"change_before_departure": {"allowed": false,"penalty_amount": null,"penalty_currency": null},// ...}}
Changes are allowed for some, but not all, of the flights
allowed
is false
at the offer or order level, but you're interested in partial changes, then you should check the conditions
inside the slices. Even if changes are not allowed for the offer or order as a whole, you may find that there are slice-specific conditions where allowed
is true
.25 GBP
fee:React
{"id": "off_123",// ..."conditions": {"change_before_departure": {"allowed": false,"penalty_amount": null,"penalty_currency": null}// ...},"slices": [{// ..."conditions": {"change_before_departure": {"allowed": true"penalty_amount": "25.00","penalty_currency": "GBP"}}},{// ..."conditions": {"change_before_departure": {"allowed": false,"penalty_amount": null,"penalty_currency": null}}}]}
Changes are allowed free of charge for all of the flights
conditions.change_before_departure.allowed
attribute on the offer or order will be true
with a zero amount:React
{"id": "off_123",// ..."conditions": {"refund_before_departure": {"allowed": true,"penalty_amount": "0.00","penalty_currency": "GBP"},// ...}}
Changes are allowed for all of the flights, but with a penalty
conditions.change_before_departure.allowed
attribute on the offer or order will be true
with a non-zero amount:React
{"id": "off_123",// ..."conditions": {"change_before_departure": {"allowed": true,"penalty_amount": "75.00","penalty_currency": "EUR"},// ...},// ...}
75 EUR
penalty as well any fare difference if the new flights are more expensive than the old ones.We don't know if changes and/or refunds are allowed
change_before_departure
and/or refund_before_departure
attributes will be null
:React
{"id": "off_123",// ..."conditions": {"change_before_departure": null,"refund_before_departure": null},"slices": [{// ..."conditions": {"change_before_departure": null,"refund_before_departure": null}},{// ..."conditions": {"change_before_departure": null,"refund_before_departure": null}}]}
We know that changes/refunds are allowed, but we don't know what penalty applies (if any)
allowed
attribute will be true
but the penalty_amount
and penalty_currency
inside the condition will be null
:React
{"id": "off_123",// ..."conditions": {"change_before_departure": {"allowed": true,"penalty_amount": null,"penalty_currency": null}// ...}}