The client ships from the Entase CDN as a single file. There is no npm package, no bundle to build, and no dependency to keep up to date — you always get the current version.
<script src="https://js.entase.com/client.js"></script>Loading the script defines a global Entase class. It does nothing else on its own: no network requests, no DOM changes, nothing rendered. Everything starts when you create an instance.
Creating an instance
const entase = new Entase({ pk: 'YOUR_PUBLISHABLE_KEY' });Create one instance per page and reuse it for every event. The constructor registers a message listener on the window and begins detecting which checkout mode your domain is allowed to use, so creating several instances means duplicated listeners and duplicated detection calls for no benefit.
Every option has a default, so new Entase() with no arguments is valid — but without pk the client cannot verify that your domain may use inline checkout, and will always fall back to a pop-up window. See Checkout modes.
Loading the script asynchronously
If you load client.js with async or defer, the class will not exist yet when your inline script runs. The library dispatches an entase:ready event on window once it has loaded, so wait for it:
<script src="https://js.entase.com/client.js" async></script>
<script>
let entase = null;
const init = () => { entase = new Entase({ pk: 'YOUR_PUBLISHABLE_KEY' }); };
if (typeof Entase !== 'undefined') init();
else window.addEventListener('entase:ready', init);
</script>The typeof check first matters: if the script has already finished loading, entase:ready has already fired and listening for it would wait forever.
Cleaning up
In a single-page application, call destroy() when the view that owns the instance unmounts:
entase.destroy();This removes the window listeners the client registered. A destroyed instance cannot be reused — calling book() on it logs an error and does nothing. Create a new instance instead.
Content Security Policy
If your site sends a Content-Security-Policy header, the checkout needs:
script-src https://js.entase.com— to load the library.frame-src https://www.entase.com— the checkout renders in an iframe in pane mode.connect-src https://www.entase.com— the client calls the Entase API to determine the allowed checkout mode.
Without frame-src, pane mode produces an empty panel. Without connect-src, mode detection fails and every checkout opens as a pop-up.