# Polar Embedded Checkout (https://talivia.com/docs/revenue-guides/polar/embedded-checkout)



Polar Embedded Checkout is a Checkout Link presented in an iframe. Attribution follows the same rule as a normal link: keep the checkout success URL on your tracked domain with `checkout_id={CHECKOUT_ID}`.

## Add the checkout trigger [#add-the-checkout-trigger]

```html title="Embedded Checkout"
<a
  href="https://buy.polar.sh/polar_cl_YOUR_LINK"
  data-polar-checkout
  data-polar-checkout-theme="dark"
>
  Buy now
</a>

<script
  src="https://cdn.jsdelivr.net/npm/@polar-sh/checkout@0.1/dist/embed.global.js"
  defer
  data-auto-init
></script>
```

Configure the underlying Checkout Link success URL before using the embed:

```text title="Success URL"
https://your-site.com/thanks?checkout_id={CHECKOUT_ID}
```

## React or programmatic embed [#react-or-programmatic-embed]

```javascript title="Open checkout programmatically"
import { PolarEmbedCheckout } from '@polar-sh/checkout/embed';

await PolarEmbedCheckout.create(
  'https://buy.polar.sh/polar_cl_YOUR_LINK',
  'dark',
);
```

Do not treat the client-side `success` event as the source of truth for revenue. Talivia records revenue from Polar's signed `order.paid` webhook and uses the browser return only for attribution.

If you create an embedded Checkout Session through the API instead of a static link, set `embedOrigin` to your site's origin and use [Checkout API metadata](https://talivia.com/docs/revenue-guides/polar/checkout-api) for the strongest match.
