Koala Smartblock docs

This section is not public yet. Enter the password you received from Koala.

Skip to main content

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:

  1. reads the trip context from window.CTStore.dataSource,
  2. maps it to a quote request and sends it to Koala,
  3. receives a price for each bundle configured for your placement,
  4. 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.

How the widget quotes a trip

Dates and time zones

This rule applies to every date-time in dataSource: provide it as a local ISO 8601 string with no UTC offset (for example 2026-07-11T06:25:00), together with the matching IANA timezone. The widget converts these into whatever the quote API needs, so you never deal with offsets yourself.

If you omit a timezone, the widget falls back to the browser's time zone. That is fine in most cases, but providing the location's own IANA timezone is more accurate (the traveller's device may be elsewhere), and it matters most for stays, where the quote needs an exact offset.

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 shapeIncludeLeave out
Flights onlysegments (flights)stays
Accommodation onlystayssegments
Flight and accommodationsegments, staysnothing
Train, bus, or ferrysegments (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 onError with a message pointing at the dataSource property 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 onAvail with status ERROR so 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.

The events surface is covered in Events and basket state.