From offer to order
Create an offer, apply the traveller's choices and create the order.
1. Create an offer
Describe the journey in the query parameters of POST /new. The itinerary goes in out and, for a return trip, home. The fares go in combo and fares.
You do not build these yourself. A search result carries them, ready to send.
Set the passengers in one of two ways, which cannot be combined:
n_adults, optionally withyoungsters_ages.passenger_ageson its own.
customer_ip is the IP address of the end customer and is used for card risk checks. It defaults to the IP of the caller, so set it when you call the API from your own server.
The response is the offer. Keep its offer_id for the calls that follow.
2. Select bundles and luggage
The offer lists what the traveller can choose:
bundle_groupsholds the bundles for each sector of the journey. One bundle in a group hasis_selectedset.service_groupsholds the extra luggage each passenger can add on each sector.
To change bundle, send its bundle_id to PATCH /{offer_id}/bundles. This resets the selected services on the bookings the bundle affects. Selections on other bookings are kept.
To add or remove luggage, send the service_id and the new quantity to PATCH /{offer_id}/services. can_increment and can_decrement on a service say whether the quantity can go up or down. Only luggage services can be selected this way.
Both calls return the updated offer, with a new summary of the prices.
GET /{offer_id} returns the offer again and extends its expiry.
3. Create the order
Send the passengers and the contact details to POST /{offer_id}/create_order.
Every passenger needs a passenger_id from the offer, a first and last name, a gender and a date of birth. The offer's requirements say when more is needed:
passport_required: send the passport details of every passenger.passport_country_required: send thepassport_countryof every passenger.
Creating the order runs a final price check. If a price has changed, the response lists the old and the new price under errors.
The response is the order. Keep its order_id for the payment.