Overview

You'll want to start building your integration in test mode.
Test mode is a "sandbox" which lets you use the Duffel API risk-free, with no danger of spending any money or booking flights you don't want!
You'll need to create a testing access token to use test mode. Head to your dashboard, make sure that you're in "Developer test mode" and create a token. Testing tokens are easy to recognize: they start with duffel_test_.
With a testing access token, you'll only be able to access resources created in test mode. With a live access token, you'll only be able to access resources created in live mode.

Airline sandboxes

While using the Duffel API in test mode, you'll likely be interacting with airlines' sandbox environments. These environments are external to our systems so, unfortunately, we are not able to provide strong guarantees about their behaviour.
For example, an airline's sandbox might be out of action due to maintenance, or flight availability might be "used up" due to other users' bookings.
We want to make sure that you have a great integration experience, from your first requests all the way to production, and Duffel having no control over the airline sandboxes should not affect that. To help with this we have created our own sandbox "airline": Duffel Airways. Making this airline available in test mode means that the Duffel team can provide stronger guarantees around the behaviour as well as the reliability of this particular airline's sandbox, meaning that you can reliably search and book no matter what.

Duffel Airways

When you search for flights in the test mode, you'll see offers from Duffel Airways. You can identify these offers amongst the other search results by looking at their owner.
The owner is an airline object, and in this case, you'll see that its name will be Duffel Airways and its iata_code will be ZZ.
Starting from a Duffel Airways offer, you can:
  • choose among multiple fare brands (when searching for business class fares)

  • list available services (that is, extra bags you can buy)

  • fetch a seat map, including free and paid seats

  • create an order for the offer and any services or seats

  • cancel your order for a refund

  • change your order, picking alternative flights

In the test mode, Duffel Airways is much more reliable than other airlines, but this comes with a significant trade-off: you won't see realistic flight schedules or prices.

Searching

To get started with Duffel Airways, you'll need to search for flights by creating an Offer Request. You can use the following request, replacing <YOUR_ACCESS_TOKEN> with your own access token:

Shell

curl --compressed "https://api.duffel.com/air/offer_requests" \
-H "Content-Type: application/json" \
-H "Accept-Encoding: gzip" \
-H "Duffel-Version: v1" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-d '{
"data": {
"cabin_class": "economy",
"slices": [
{
"departure_date": "2021-02-09",
"destination": "JFK",
"origin": "LHR"
}
],
"passengers": [
{
"type": "adult"
}
]
}
}'
For more information on creating offer requests, see 'Create an offer request'.
With the results from a search you will then be able to create orders, see 'Create an order'.
If you have any feedback on the Duffel Airways test mode, drop us a line.

Test card numbers

You cannot use real card details when confirming a Payment Intent in test mode. Instead, you should use one of the test cards listed here.
All test cards accept any 3 digits as CVC, and any future date as Expiry date.
Cards from different countries can be used to test local vs international fees. For example, if you are based in France, you can use our Irish and Australian test cards to simulate local and international payments respectively.
NumberCountryResult
4000 0082 6000 0000Great BritainPayment collection succeeds
4000 0037 2000 0005Ireland (European rate)Payment collection succeeds
4000 0003 6000 0006AustraliaPayment collection succeeds
4242 4242 4242 4242USAPayment collection succeeds
4000 0000 0000 3220USA3D Secure 2 authentication will be triggered and payment collection will succeed
4000 0000 0000 9995USAPayment collection fails due to insufficient funds
Please note that test cards are only for use with Duffel Payments. If you need a test card for any other reason, please get in touch with your contact at Duffel.