Skip to content
Blog

Travel API sandbox testing: what the sandbox won't show you

Tekravel Editorial
Written with the help of AI

The integration passed everything travel API sandbox testing could throw at it. Search returned flights, the hotel availability call came back with rooms, the booking call returned a confirmation number every single time, and QA signed it off on a Thursday. The following Tuesday a customer paid for a hotel at one price and the supplier confirmed it at another, a flight booking timed out and nobody could say whether a seat was held, and a support agent spent an afternoon reconciling two records that described the same trip. None of that was a bug the test suite missed. It was a scenario the test suite never had a way to see. A sandbox is necessary, it is nowhere near sufficient, and the gap between the two is where most of the expensive incidents in a travel integration live.

This is a test plan for the developer who owns that integration: what a sandbox can prove, what it structurally cannot, and how to cover the difference without booking real seats on the company card.

Why travel API sandbox testing passes code that production breaks

A sandbox is a promise about the shape of responses, not about their behaviour. The schema matches production. The behaviour almost never does, for reasons that are nobody's fault: a test environment cannot afford to run live inventory, so it serves a fixed set of fares and rooms that never sell out, never reprice and never change schedule. It answers quickly because nobody else is using it. It rarely fails halfway.

Production does all of those things daily. Inventory is shared with every other seller; fares are cached by somebody upstream and go stale; a supplier's system under load answers slowly or not at all. Code that has only ever seen a sandbox has, in effect, only been tested against a supplier having a perfect day.

So treat the sandbox as one layer of three. It proves your requests are well formed and your parser understands the schema. Recorded fixtures prove your code survives the responses production actually sends. A small, deliberate set of live checks proves the wiring after something changes. Each layer catches what the other two cannot.

The scenarios a sandbox usually cannot give you

Write these down before you write a single test. A sandbox may simulate one or two of them with a magic test value; most it simply does not have.

ScenarioWhat production doesHow to cover it
Price changes between search and bookingThe booking call succeeds at a different total, or fails with a price-change error you must surfaceFixture pair: a search response and a booking response with a different total; assert the traveller is asked again, never silently charged
Sold out between availability and bookingThe room or fare class that was offered is gone when you try to hold itFixture of the supplier's real sold-out error; assert the traveller goes back to results, not to an error page
Timeout on the booking callThe supplier may or may not have created the bookingInject a timeout after the request is sent; assert you query booking status before anything retries
Duplicate submissionA double-click or a client retry creates two bookingsSend the same booking twice with the same idempotency key; assert exactly one booking exists
Schedule change after ticketingThe flight you sold now departs at another time, or under another flight numberFixture of a modified itinerary; assert the change reaches whoever owns the customer
Partial success on a multi-item bookingThe flight confirms and the hotel does notMixed fixture; assert the system records exactly what was confirmed and alerts a human
Throttling under loadRate-limit responses, then slow answersReplay a recorded throttling response; assert backoff, and that search degrades rather than errors

You may disagree with the last column for your own stack. Fine. What matters is that every row has an owner and an assertion, because each one will eventually happen to you.

Build fixtures from real responses, not invented ones

The most useful habit in a travel integration is keeping the responses that surprised you. Hand-written mock data reflects what you think a supplier sends; a recorded response reflects what it actually sent, including the fields that are empty when the documentation says they never are, the price in a currency you did not ask for, and the error that arrives with a success status.

A routine that works:

  • Record at the boundary. Log raw request and response bodies for supplier calls in a non-production environment, and in production for a sampled share of traffic if your privacy rules allow it.
  • Scrub before you keep. Passenger names, passport numbers, emails, phone numbers and payment references come out before a fixture enters the repository. Replace them with obviously fake values so nobody mistakes a fixture for a real booking.
  • Name fixtures by behaviour. hotel-book-price-increased.json tells the next developer why it exists; response-17.json does not.
  • Keep the ugly ones forever. The malformed response that took down search one Sunday is the most valuable file you own. It belongs in a test that runs on every commit.

Then write contract tests against those fixtures: your parser, your mapping into internal models, your error classification. If a supplier renames a field and a contract test fails, you learn it in CI instead of from a customer. The classification side is covered in more depth in our piece on booking engine API error handling.

Testing the money paths without spending money

Here the sandbox helps least, because the money paths are exactly where a test environment differs from the real one. Real ticketing, real card capture and real supplier invoicing are what you most need to get right and are least able to rehearse live.

Split the problem. Pricing math is pure logic and can be tested exhaustively offline: take recorded fares, apply your markup rules, currency conversion and rounding, and assert the total a traveller sees. Do it for the awkward cases — a fare in one currency sold in another, a markup that is a percentage on one product and a fixed amount on another, a child fare, a rounding step that differs between display and charge. A total that is wrong by a few units of currency is still wrong, and it is wrong on every booking.

The state transitions around payment are the second half. Model them explicitly — quoted, held, paid, confirmed, ticketed, cancelled, refunded — and test that every transition has exactly one cause. The test that catches the most expensive bug is the one asserting that a payment cannot be captured for a booking the supplier has not confirmed, and that a confirmed booking cannot exist without a payment record.

Finally, make it impossible for a test run to reach live ticketing. Not unlikely; impossible. A start-up check that refuses to run the suite when production credentials are loaded costs one line and prevents the worst morning an integration team can have.

What it costs you if you get it wrong

A missed scenario in a travel integration rarely shows up as an error. It shows up as a booking that looks fine. A duplicate ticket nobody asked for, which someone has to void before the deadline. A hotel confirmed at a price the agency now has to absorb. A timed-out booking that the system retried, so the supplier holds two rooms and invoices both. For an airline ticket sold through an agency, a mismatch between what was issued and what was sold can come back later as an ADM, long after the margin on that sale was spent.

Those costs land on the business that sold the trip, not on the developer who wrote the retry loop. That is the whole argument for testing them before launch rather than learning them one support ticket at a time.

What to smoke-test after every supplier change

Suppliers change things: a new API version, a new endpoint, a rotated credential, a different content mapping. Your own code may not have changed at all. Run this list anyway, in the environment that talks to the changed supplier:

  1. One search per product you sell from that supplier, on a route or city you know returns results.
  2. Parse every result without silently dropping any; compare your count with what the raw response contains.
  3. Price one result end to end and compare the displayed total with your own calculation from the raw fare.
  4. Make a booking in the test environment, read its status back and compare every field you store.
  5. Cancel it and confirm the cancellation is visible both in your records and on the supplier's side.
  6. Replay your saved ugly fixtures through the new parser.
  7. Check that timeouts and rate limits still map to the behaviour you decided on, because a new version may answer them differently. If response times moved, the latency piece explains which part of that is yours to fix.

Short enough to run every time, which is the point. A smoke test nobody runs because it takes a day is not a smoke test.

Where the sandbox fits

None of this makes a sandbox less useful. It makes it honest: the place where you learn the schema and confirm the requests are right, before fixtures and live checks take over the parts it cannot reach. If you are evaluating the platform's flight and hotel APIs, access starts as a conversation rather than a self-serve key — bring this test plan to that conversation and ask how each row of the table above would be covered. The answers will tell you more about an API than its documentation does.

Tekravel Editorial

Travel technology desk

The Tekravel travel-technology desk writes for the trade: agency owners, consolidators and the developers who integrate them. Every article is checked against the platform it describes before it is published.