Booking Flows
The steps for booking tickets and rail passes, from search to issued tickets, for each payment method.
Ticket booking flow
- Search for journeys: Use
journeysto find journeys between two locations, and pick one. - Get offers: Use
journeyOfferto price the journey for your passengers. - Create a booking: Call
createBookingwith one or more offer ids, and optionallypassengers. - Add passenger details: Call
updateBookingwith each passenger's details. Exactly one passenger must be the contact person, with an email address and a phone number.createBookingonly takes placeholders (type, age, travel cards), so this step is always needed. - Create an order: Call
createOrderto pre-book the tickets. This step is the same for every payment method. - Finalize the order: Call
finalizeOrderto complete a purchase paid by wallet or invoice. If your customer pays, pass the order'sidtocreatePaymentinstead. The order is then finalized automatically when they have paid. - Get the tickets: Tickets are issued automatically, most of them within 15 minutes. Poll the order with
nodeuntil they appear.
Quick Start has an example of each step.
Round trips
Both directions of a round trip are priced in one call, so that operators with return fares can quote them. Steps 1 to 3 become:
- Search each direction: Run two
journeyssearches, the second with origin and destination swapped, and pick a journey from each. - Price them together: Call
combinedJourneyOfferwith the two journey ids. - Create one booking: Call
createBookingwith the offer ids from both directions in oneofferIdslist.
The rest of the flow is the same. Make one booking, not one per direction. A return fare is a single ticket priced across both directions, so its offers can only be booked together. See Round Trips.
Rail pass booking flow
- Find passes: Use
getPassBundlesto find passes for your passengers, and pick a product, class and number of travel days. - Create a booking: Call
createBookingwith the pass bundle id. - Add passenger details: Call
updateBookingwith each passenger's details. Exactly one passenger must be the contact person, with an email address and a phone number. This step is always needed. - Create an order: Call
createOrderto pre-book the pass. This step is the same for every payment method. - Finalize the order: Call
finalizeOrderto complete a purchase paid by wallet or invoice. If your customer pays, pass the order'sidtocreatePaymentinstead. The order is then finalized automatically when they have paid. - Get the pass codes: Pass codes are issued automatically, most of them within 15 minutes. Poll the order with
nodeuntil they appear.
Payment methods
Every payment method starts with createOrder, which pre-books the tickets. The next step depends on how the order is paid:
| Payment method | After createOrder |
|---|---|
| Wallet | Call finalizeOrder. The order total is deducted from your credits. |
| Invoice | Call finalizeOrder. The order is added to your monthly invoice. |
| Payment gateway | Call createPayment and redirect the customer to the payment URL it returns. The order is finalized when they have paid. |
Tickets are issued once the order is finalized. See Payments for each method.
Seat reservations for passholders
A traveler who already holds an Interrail Pass books seat reservations through the ticket flow. Attach the pass to each passenger as a travel card when you get offers, and send the same passengers, with the pass's identifier, when you create the booking. The rest of the flow is the same. See Travel Cards.
Error handling
Any step can fail: a search finds nothing, an offer sells out, a booking expires. See Error Codes for what each error code means and how to handle it.