The embedded checkout renders Polar’s checkout form in an overlay on top of your page rather than redirecting the customer away. This keeps your branding in view throughout the payment flow and typically improves conversion rates. The package ships a Blade directive, a Blade component, and an HTMLDocumentation Index
Fetch the complete documentation index at: https://danestvesllc-2b77d201.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
data- attribute — covering Blade, Inertia, React, and Vue with minimal setup.
How it differs from hosted checkout: Instead of returning a redirect from your controller, you pass the checkout URL to your view and render a button with
data-polar-checkout. The Polar JavaScript library intercepts the click and opens the overlay.Setup
Add the embed script to your layout
Include the The directive outputs a single
@polarEmbedScript directive inside the <head> tag of your layout. This loads the Polar JavaScript library that intercepts clicks and renders the overlay:<script> tag that defers loading and auto-initialises, so it does not block page rendering.Create the checkout with an embed origin
In your controller or route, build the checkout session and call Do not call
withEmbedOrigin with your application’s URL. This tells Polar’s iframe which origin is allowed to communicate with it:redirect() or return the $checkout directly — pass it to the view so the front end can use the URL.Render the button in your Blade view
Use the The component renders an
<x-polar-button> component. Pass the $checkout object and the component resolves the URL and wires up the data-polar-checkout attribute automatically:<a> tag. You can pass any standard HTML attribute and it will be forwarded to the anchor element.Changing the theme
The embedded checkout defaults to a light colour scheme. To use a dark scheme, pass thedata-polar-checkout-theme attribute:
Inertia.js
For Inertia applications you cannot use the Blade component directly. Instead, pass the checkout URL as a prop and add thedata-polar-checkout attribute to any <a> tag. The Polar script picks up the attribute and opens the overlay on click:
data-polar-checkout-theme="dark" on the element if you want the dark colour scheme.
The
data-polar-checkout attribute is what the Polar JavaScript library looks for. As long as the @polarEmbedScript directive is present in the page <head> and your <a> tag carries data-polar-checkout, the overlay will open regardless of whether you are using Blade, Inertia, or a fully client-side framework.