If you are building flight booking for an online travel agency (OTA), the API calls are the easy part. The hard part is what happens between them: prices that change after search, bookings that expire, and tickets that fail after the card was charged.
This post walks through the four steps every OTA flight integration needs, with the decisions you should make at each step. The code is plain JavaScript and the endpoints are generic examples, so you can map them to whichever flight API you use.
The four steps
- Search: show available flights and fares
- Re-price: confirm the exact price of the option the traveller picked
- Book: create the booking (PNR) with passenger details
- Ticket: issue the e-ticket after payment
Then there is a fifth step that many teams forget until launch: servicing (changes, cancellations and refunds).
1. Search: fast, but never final
A flight search usually returns results from several sources at once: GDS content for full service airlines, NDC offers sold directly by airlines, and low cost carriers. A good aggregator merges these into one response.
const res = await fetch("https://api.example-flight-provider.com/search", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` }, body: JSON.stringify({ origin: "DEL", destination: "DXB", departureDate: "2026-12-20", adults: 2, cabin: "ECONOMY" }) }); const { offers } = await res.json(); Two decisions to make here:
Caching. Caching search results makes your pages fast, but fares go stale quickly, especially on low cost and NDC content. Cache for seconds or minutes, not hours, and treat every search price as an estimate.
Duplicates. The same flight can come back from GDS and NDC with different fare brands. Group results by flight and show fare options (Basic, Standard, Flex) instead of a long list of near duplicates.
2. Re-price: the step that protects conversion
Before the payment page, confirm the price of the selected offer.
const priced = await api.post("/price", { offerId: selected.id }); if (priced.totalAmount !== selected.totalAmount) { // Never change the price silently showPriceChangeNotice(selected.totalAmount, priced.totalAmount); } Decide in advance what your UI does when the price changes:
- Show the new price with a clear message and let the traveller confirm
- Offer the next best option if the fare is gone
- Never jump the price on the payment screen without telling the traveller
This is also the step where you fetch fare rules: baggage allowance, change fees and refund conditions. Show them before payment, not after.
3. Book: create the PNR and watch the clock
const booking = await api.post("/book", { offerId: priced.id, passengers: [ { type: "ADT", firstName: "Asha", lastName: "Mehta", dateOfBirth: "1990-04-12" }, { type: "ADT", firstName: "Ravi", lastName: "Mehta", dateOfBirth: "1988-09-03" } ], contact: { email: "asha@example.com", phone: "+911234567890" } }); // Store this: unticketed bookings expire const ticketBy = booking.ticketingTimeLimit; Unticketed bookings have a ticketing time limit. If payment is slow or fails, the booking can be cancelled automatically. Store the deadline and run a job that alerts or retries before it passes.
4. Ticket: make it idempotent
In B2C, the traveller pays first and the ticket is issued after. The dangerous case is a successful payment followed by a failed or timed out ticketing call.
await api.post("/ticket", { bookingId: booking.id }, { headers: { "Idempotency-Key": paymentId } // retrying will not issue twice }); Use an idempotency key (for example, your payment ID) so a retry never creates a second ticket or a second charge. Then define a clear fallback: retry, notify support, or refund automatically.
5. Servicing: self service saves your support team
After ticketing, travellers will want to change dates, cancel or add a bag. If your API supports cancellations, reissues and refunds, expose them in your own interface:
- Show the change fee and fare difference before the traveller confirms
- Show refund status until the money is back
- Allow seats, baggage and meals after booking, not only during it
Every change a traveller can do alone is one less support ticket.
One API, many channels
Most OTAs sell on more than a website: Android and iOS apps, mobile web, and increasingly chat apps like WhatsApp. If all channels run on the same flight API, fares and bookings stay consistent wherever the traveller starts, and you maintain one integration instead of several.
Checklist before you choose a provider
- Which sources are included: GDS, NDC, low cost carriers, private or series fares?
- Are prices live at search, and is there a separate re-price call?
- Are fare rules and baggage returned before booking?
- Does the API return a ticketing time limit for each booking?
- Is ticketing idempotent, and how are failures reported?
- Are cancellations, reissues and refunds supported through the API?
- Can you set your own markup by route, airline or fare type?
- Is there a sandbox with real airline data?
Wrapping up
Search gets the attention, but OTAs usually win or lose on the steps around it: honest re-pricing, careful handling of time limits, safe retries on ticketing, and self service after booking. Get those right and the rest of the integration becomes routine.
If you are comparing providers, this overview of a flight booking API for online travel agencies shows how search, ticketing and servicing can come through one integration.

