Adding Post Booking Bags

Note

The ability to book post-order is not available for all airlines yet. We recommend using easyJet to follow along on this guide.

What do you need to start?

This guide will go through the changes you need to list and book services for an order you've previously booked. It's important you have already made a booking before following this guide.

  • If you are not familiar with how to create an order please heads over to our Quick Start Guide.
  • This guide will start from an order so make sure you grab an order ID for an easyJet flight before we start.

Tip

We've put together a Postman Collection that contains all of the requests you'll need to follow along with this guide.

Overview

Baggages are a type of what we call available_services. The changes we'll make to work with available services are:

  • Retrieve a list of available_services for an order
  • Pay for and book the services

Getting services for an order

We start by fetching the bags for the order. Using a valid order id you can use:

curl -X GET --compressed "https://api.duffel.com/air/orders/$ORDER_ID/available_services"
  -H "Accept-Encoding: gzip"
  -H "Accept: application/json"
  -H "Duffel-Version: v2"
  -H "Authorization: Bearer $YOUR_ACCESS_TOKEN"

This request will return a list of the available_services.

Available services

The only available service currently supported is baggages. Each available service is unique and identifiable by id. The price of the service is described by total_currency and total_amount. And the actual service information is determined by its type and metadata.

Important to notice that services are specific to segments and passengers. The relationship is described by the attributes segment_ids and passenger_ids.

Note

Please also note that baggage can only be added to existing orders where baggage was not part of the original booking.

Learn more

For a complete description of the available services schema checkout the API reference.

Booking services

Once you know what service a user wants to book all you have to send request to the post-booking services endpoint with the following payload.

curl -X POST --compressed "https://api.duffel.com/air/orders/$ORDER_ID/services"
  -H "Accept-Encoding: gzip"
  -H "Accept: application/json"
  -H "Content-Type: application/json"
  -H "Duffel-Version: v2"
  -H "Authorization: Bearer $YOUR_ACCESS_TOKEN"
  -d '{
  "data": {
    "payment": {
      "type": "balance",
      "currency": "'