Skip to content

Embedded sale flow

Some providers do not sell through the standard cart flow: they need the end customer to make their selection in a specialised interface — a seat map, for instance — that is served externally and embedded in your site.

This method returns the widget script that embeds that flow. You keep control of the cart, the checkout and the experience; the widget only provides the selector and hands you back a token representing what the customer picked.

In the activities catalog, the EmbeddingRequiredProviders field lists the providers whose selection happens in an external flow. For those providers this widget is the integration mechanism: they cannot be sold by adding products to the cart the usual way.

GET /activity/LoadSaleFlowUI

Returns JavaScript, not JSON.

All three parameters go in the query string and are required:

  • ProviderId: (string). Provider identifier, taken from the catalog.
  • TicketEnclosureId: (string). Ticket enclosure identifier, taken from the catalog.
  • SessionId: (string). Session identifier, taken from sessions.

The script is requested with your API key, and that key must not travel in the browser. The recommended approach is to put your own backend in between:

  1. Expose an endpoint in your backend, for example /embed-session, taking the three identifiers.

  2. Build the call server-side, adding the Authorization: ApiKey ... header there.

  3. Return the JavaScript you receive to your frontend with Content-Type: text/javascript.

That way the frontend never sees the key: it asks your backend for the script, and your backend acts as the proxy.

The widget adapts to the space available in the container you point it at:

<div id="flowui-container"></div>

The frontend requests the script from your backend, not from the API directly:

<script async type="text/javascript"
src="/embed-session?ProviderId=MY_PROVIDER_ID&TicketEnclosureId=MY_TICKET_ENCLOSURE_ID&SessionId=MY_SESSION_ID"
onload="window._initWidget && window._initWidget()"></script>

The widget reports progress through three callbacks. Implement both OnCartUpdated and OnCartPurchased, because depending on the integration either one, the other, or both may fire:

window._initWidget = function () {
if (window._widgetInitialized === true) return; // avoid double initialisation
// Wait until the script has defined the widget
if (!(window.Experticket && window.Experticket.Widget
&& typeof window.Experticket.Widget.Load === 'function')) {
setTimeout(window._initWidget, 50);
return;
}
window._widgetInitialized = true;
var lastToken = null;
Experticket.Widget.Load('flowui-container')
.OnCartUpdated(function (items, token) {
lastToken = token; // keep it: this is what you take to the cart
})
.OnCartPurchased(function (items, token) {
lastToken = token;
})
.OnCartCancelled(function () {
lastToken = null; // the token is no longer valid
});
};
  • token (string): an opaque string representing what the customer selected. This is the operational value: store it, because it is what lets you sell.
  • items (array): the breakdown of the selection, informational only, so you can render your own summary. The suggested shape is { id, name, basePrice, fee, finalPrice }.

The id of an item can repeat when the product is the same — two adjacent seats with the same logical identifier, for example. In that case you can group them and show something like “2 × adult seat in section X”.

Here is the main difference if you are coming from the Experticket documentation: in ExpertHub the token is handed over when adding to the cart, not on the reservation.

  1. Add the token to the cart with add items to the cart, in the Tokens field:

    {
    "ShoppingCartId": "CART_ID",
    "Tokens": [
    { "ProviderId": "MY_PROVIDER_ID", "Token": "THE_WIDGET_TOKEN" }
    ]
    }
  2. Carry on with the normal flow: reserve and then confirm the sale. Nothing is special from here on.