How it works
- Create a checkout session on your server with your secret API key (see Checkout API) and read its
checkoutUrl. - Load the Creem embed script on your page.
- Open the checkout as an overlay or inline, and handle
onComplete.
1. Create a checkout session (server-side)
Every embed needs a checkout URL, created on your server with your secret API key so the price and product can’t be tampered with. Use the Checkout API or one of its SDKs and readcheckoutUrl (the raw REST API returns it as checkout_url):
2. Choose an embed path
Use exactly one of the three paths below — framework SDKs, the script loader, or a raw iframe.Framework SDKs
First-class packages for React, Vue, and Svelte with typed props and lifecycle events. They share a framework-agnostic core,@creem_io/embed, which you can also use directly in vanilla JS.
- React
- Vue
- Svelte
useCreemCheckout() hook and the CreemEmbedCheckout.create() promise API. Full reference →theme, locale) and emits the same ready + completed events. On completion, if the product has a Return URL, the page navigates there automatically (after a short confirmation screen) — handle onComplete for custom behavior.
Script loader
For non-framework apps, or when you want a globalCreem object. No build step — drop in the loader script and open checkout from any framework or plain HTML.
Overlay
The overlay shows the confirmation screen on success; callCreem.close() from onComplete if you want it to dismiss automatically.
Inline
Mount checkout inside a container on your page:Declarative data attributes
Any element withdata-creem-checkout opens the overlay on click — no JS wiring, but it still relies on the loader script above:
data-creem-theme and data-creem-locale:
Raw iframe
The lowest-level option — no loader, no SDK. Use it when you only need inline display and will handle the lifecycle yourself, or don’t need callbacks:Presentation — theme & language
Works with the framework SDKs and the script loader.openCheckout and mount accept two presentation options, appended to the checkout URL for you:
locale to force a specific one (e.g. to match your own site’s language). Unsupported locales fall back to English. See the supported languages for the full list.
API reference
The framework SDKs (@creem_io/react, /vue, /svelte) accept these same options — as props/args, with onComplete/onClose surfaced as the complete/close events where idiomatic.
Creem.openCheckout(options)
Opens checkout in a modal overlay.
The checkout session URL from the Checkout API.
Color theme for the checkout. Defaults to light.
BCP47 language tag (e.g.
'fr', 'pt-BR') to force the checkout language. Defaults to the customer’s browser language; unsupported locales fall back to English.Called once the checkout UI has rendered and is ready for input.
Called when payment completes.
detail = { checkoutId, orderId?, orderNo?, redirect?, redirectUrl? } — redirectUrl is the merchant success URL, if set.Called when the overlay is dismissed by the customer.
Creem.mount(options)
Mounts checkout inline. Same options as openCheckout, plus:
The element (or a CSS selector) to mount the checkout iframe into.
Creem.close()
Programmatically closes the overlay.
Events
Under the hood, the checkout posts messages to the parent window over its lifecycle. The loader handles these for you (onReady, onComplete); if you build a fully custom integration (e.g. a raw iframe), listen for them directly:
Always
"creem-embed".Protocol version (currently
1)."ready" when the UI has rendered, then "completed" on payment.Digital wallets. Apple Pay / Google Pay can require domain registration with the card networks and may be unavailable inside a cross-origin iframe. Card and 3-D Secure payments always work in the embed; if wallet buttons are critical for you, the hosted checkout page remains the most reliable surface today.