Trip data and pricing
The bundles the widget shows are configured by Koala, but their prices are calculated for the specific trip. You
provide the trip; Koala prices each configured bundle against it and the widget renders the result. This section
explains that exchange and exactly what to put in window.CTStore.dataSource.
How the exchange works
When the widget starts, or after a restart when calling window.CTStore.koala.restart(), it:
- reads the trip context from
window.CTStore.dataSource, - maps it to a quote request and sends it to Koala,
- receives a price for each bundle configured for your placement,
- renders those bundles as priced options.
What the traveller sees is specific to their booking and shown in their own currency, not a generic rate.
Dates and time zones
Every date-time in dataSource is a local ISO 8601 string with no UTC offset (for example 2028-07-11T06:25:00):
the time on the clock at the place of departure, arrival, check-in or check-out. You never deal with offsets yourself.
Flights are quoted on those local times as they are. Stays are the exception: the quote needs an exact offset for
check-in and check-out, so give each stay its IANA timezone. Without it the widget uses the browser's time zone,
which is wrong whenever the traveller books from somewhere else.
The trip context
You populate window.CTStore.dataSource with the trip context. The full field-by-field shape, with example values and
complete payloads to start from, is documented in the reference page Trip context.
Send only what the trip has
Beyond currency and travelers, you include only the parts of the trip that actually exist:
| Trip shape | Include | Leave out |
|---|---|---|
| Flights only | segments (flights) | stays |
| Accommodation only | stays | segments |
| Flight and accommodation | segments, stays | nothing |
| Train, bus, or ferry | segments (generic) | stays |
A single trip can mix modes, for example a flight followed by a train, by listing different segment types in the
segments array. Optional fields (residence, numberOfCheckedBags, stop coordinates, or a full address) can be left
out when you do not have them; baggage cover needs numberOfCheckedBags.
When it re-quotes
The widget quotes once at load. If the trip changes afterwards, for example the dates, travellers, or currency, update
dataSource and call window.CTStore.koala.restart() so the widget re-reads it and re-quotes.
If quoting fails
Two things can go wrong, and each surfaces on its own event:
- The trip context is incomplete or malformed: no quote request is sent, and the widget emits
onErrorwith a message pointing at thedataSourceproperty to fix. This is an integration problem to solve during development. - The quote request fails: the request was sent but Koala could not return quotes (the service rejected the trip or
was unreachable). The widget does not render priced options and emits
onAvailwith statusERRORso your page can respond (hide the section, fall back, or log it).
A quote can also succeed without pricing a single bundle, for example when every bundle is inside its purchase
cutoff. That is not a failure: onAvail fires with status SUCCESS and count: 0, the rejections and their reasons
are in response.data.quotes, and the widget renders nothing. Nothing was offered, so no request is prepared either:
basketPayload stays undefined and there is nothing to send after the booking.
The events surface is covered in Events and basket state.