book() is the method that opens the checkout. Everything else on the client configures it or observes it.
entase.book(eventID);
entase.book(eventID, options);eventID is the identifier of the scheduled event to sell. It is the same id used in your event's share and embed codes.
The call returns immediately — it opens the panel or window and does not wait for the visitor to finish. Use events to react to what happens next.
Options
| Name | Type | Default | Description |
|---|---|---|---|
checkoutMode | string | instance value | 'pane' or 'popup' for this booking only. |
clientContext | object | null | Arbitrary data handed to the checkout once it is ready. See below. |
collectConsent | boolean | instance value | Whether to ask the visitor to accept the terms notice. |
backdrop | boolean | instance value | Whether to dim the page behind the checkout. |
backdropColor | string | instance value | Colour of the dimmed area. |
pane | object | instance value | { width, height } for the inline panel. |
popup | object | instance value | { width, height } for the pop-up window. |
Anything you leave out falls back to the value the instance was constructed with, so per-call options are additive rather than a replacement set.
entase.book('EVENT_ID', {
pane: { width: '60vw' },
backdrop: false,
clientContext: { source: 'homepage-hero' }
});Client context
clientContext is an object of your own design. The client holds it until the checkout signals that it is ready, then hands it over. Use it to carry information that only your page knows — which button was clicked, which campaign a visitor arrived on, an internal customer reference — through to the checkout session.
The context is stored per event id, so booking two different events from the same page keeps their contexts separate.
Do not put anything sensitive in it. It travels to the checkout through the browser and is visible to anyone inspecting the page.
Opening several events from one page
One instance handles any number of events. Create it once and pass a different id each time:
const entase = new Entase({ pk: 'YOUR_PUBLISHABLE_KEY' });
document.querySelectorAll('[data-event-id]').forEach(button => {
button.addEventListener('click', () => {
entase.book(button.dataset.eventId, {
clientContext: { source: button.dataset.source }
});
});
});After the client is destroyed
Calling book() on an instance you have already destroyed logs an error to the console and opens nothing. This is deliberate — a destroyed instance no longer listens for messages from the checkout, so the window it opened could not be closed or observed. Create a new instance instead.
Closing the checkout
The visitor closes the checkout themselves: Escape or a click on the dimmed area in pane mode, the window controls in pop-up mode. The checkout also closes itself when a booking completes.
There is no public method to close it from your code. If you need to know when it closed, listen for the checkout.closed event.