Skip to main content
Your page loads the SDK once, then mounts its element wherever the founder should see it. You need your publishable key (pk_test_... or pk_live_...) and a session route on your server.

Install

The package is under 1 KB gzipped, ships its TypeScript types, and works as ESM or CommonJS. It contains no UI: it loads doola’s versioned loader from js.doola.com, which mounts the iframe.

Mount

  • create() takes no arguments. The iframe shows the wizard, the payment screen or the dashboard depending on the customer’s state.
  • The element is <doola-embed>, a full-width block whose height follows its content.
  • Append it to mount, remove it to unmount. To show a fresh state, such as the founder’s company after payment, replace it with another doola.create(). Each call creates a separate iframe, so never append a second one beside it.
Every option is described in the client reference.

One instance per page

loadDoola() creates one SDK instance for the page, and its options are fixed by the first call.
  • Calling loadDoola() again with the same publishable key returns the live instance and ignores the new options, callbacks included. React StrictMode’s double invoke is therefore safe.
  • Calling it with a different key rejects until you call destroy().
So keep the instance outside your components, and route its callbacks to whichever screen is mounted now. One small module does both:
doola.ts

Frameworks

loadDoola() runs in the browser only and rejects on the server, so call it from a client-only path.
DoolaFormation.tsx
To show the founder’s dashboard after you confirm payment, remount the component, for example by changing its key.

Sign out

Call destroy() when your user signs out of your product. It ends the doola session and removes every element, and the instance cannot be used again. To embed for the next user, call loadDoola() again. Never call destroy() on an ordinary unmount or route change. Remove the element instead; the session stays alive for the next mount.

Load faster

Start the connections early with two hints in your <head>:
With test keys, point the second hint at https://sdk.test.doola.com.

Content Security Policy

If your site sends a CSP, allow the loader and the iframe:
With test keys, also allow https://sdk.test.doola.com in frame-src. If you enforce Trusted Types, allow the doola-js policy. See Security and data.

When it cannot load

loadDoola() rejects when the SDK cannot start, so your page shows its own fallback:
  • It ran outside a browser, for example during server rendering.
  • The loader script was blocked by a CSP, an ad blocker or the network.
  • An option is invalid, such as a key that is not pk_test_... or pk_live_.... The message names it.
Once the iframe is running, it shows its own error screens. Pass onLoadError to log them, and see Errors for the one case where your page is the only place to tell the founder.
Last modified on October 8, 2026