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.
When you need it
Section titled “When you need it”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.
Access method
Section titled “Access method”GET /activity/LoadSaleFlowUI
Returns JavaScript, not JSON.
Request data structure
Section titled “Request data structure”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.
Do not expose your API key in the browser
Section titled “Do not expose your API key in the browser”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:
-
Expose an endpoint in your backend, for example
/embed-session, taking the three identifiers. -
Build the call server-side, adding the
Authorization: ApiKey ...header there. -
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.
Using the widget
Section titled “Using the widget”Container
Section titled “Container”The widget adapts to the space available in the container you point it at:
<div id="flowui-container"></div>Loading the script
Section titled “Loading the script”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>Initialisation and callbacks
Section titled “Initialisation and callbacks”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 });};What you get back
Section titled “What you get back”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”.
From token to sale
Section titled “From token to sale”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.
-
Add the token to the cart with add items to the cart, in the
Tokensfield:{"ShoppingCartId": "CART_ID","Tokens": [{ "ProviderId": "MY_PROVIDER_ID", "Token": "THE_WIDGET_TOKEN" }]} -
Carry on with the normal flow: reserve and then confirm the sale. Nothing is special from here on.