Skip to main content
Embedded checkout opens the Polar checkout as a full-screen overlay on your page, instead of redirecting the customer to Polar. It’s the same hosted checkout, loaded in an iframe on top of your site, with a spinner until it’s ready. Before embedding, add your site to the allowed embed hosts. The checkout only opens on hosts you’ve listed.

Add the snippet

The snippet works on any site or CMS that accepts HTML.
  1. Create a Checkout Link.
  2. Open the link, select the Embed tab and click Copy.
  3. Paste the snippet into your page.
The snippet looks like this, with your link’s URL in place of __CHECKOUT_LINK__:
HTML
Clicking the element opens the checkout. Style it however you want, as long as it keeps the data-polar-checkout attribute. On an element without href, such as a <button>, put the URL in the attribute: data-polar-checkout="__CHECKOUT_LINK__".
The snippet loads @latest. Replace it with a fixed version of @polar-sh/checkout to control when you upgrade.
The script also exposes the embed class as window.Polar.EmbedCheckout, for pages without a bundler.

Use the library

In a JavaScript app, install the library instead of adding a script tag:
Call PolarEmbedCheckout.init() once to wire up every element with data-polar-checkout. In React:
React

Open the checkout from code

PolarEmbedCheckout.create() opens the checkout and resolves once it has loaded:
TypeScript

Events

Events are cancelable CustomEvents on the checkout instance. Call event.preventDefault() to skip the default action. Grant access from webhooks or the customer state, not from the success event.

Embed a checkout session

You can embed a Checkout Session URL instead of a link. Set embed_origin when you create the session, to the origin of the page that embeds it:
Why: the checkout sends its close, confirmed and success messages only to the origin stored on the session. Checkout Links don’t need this: the script adds your page’s origin when it opens the link. The examples use the sandbox and API version 2026-10.

Theme and language

The embedded checkout is the hosted checkout, so the same query parameters apply: theme and, with localization on, locale. AI agents in the browser can’t use the checkout tools on an embedded checkout. Those are only on the hosted page.

Embed hosts

The checkout opens only on hosts listed under Settings → Embedding. If the overlay stays blank and the browser console mentions frame-ancestors, the page’s host isn’t on the list. See Embed hosts for the format and the API field.

Enable wallets in Embedded Checkout

Wallets such as Apple Pay and Google Pay appear in an embedded checkout only on hosts under a verified domain. On Polar’s hosted checkout, they work with no setup. To enable them:
  • Verify your domain under Settings → Domains
  • Open Settings → Embedding
  • Add each host that embeds the checkout, such as shop.example.com
A wildcard entry like *.example.com doesn’t enable wallets. Add each subdomain on its own. Each host in the list shows its wallet status. A host under a verified domain shows Wallet payments pending until your organization can accept payments.

Learn more