Iframe embedding
Render the hosted checkout form inside your page and listen to postMessage events to drive your own UX.
Before you start
Origin allow-list requiredBy default the checkout responds with
Unauthorized โ this page cannot be embedded from this originwhen loaded inside an<iframe>. Send us the origin (or list of origins) you plan to embed from and we'll allow them.
Same customization as the standalone checkoutForm appearance, locale, payment methods and branding are configured the same way as the standalone checkout โ see Hosted Checkout customization.
Embedding
<iframe
src="https://checkout.carusell.world/s/{sessionId}"
width="100%"
height="720">
</iframe>Inside an iframe:
- All outbound links open in a new tab.
- The Back to store button emits a postMessage instead of navigating.
Listening to events
The iframe posts messages to the parent window. Every message shares the same envelope; only payload varies between events:
{
type: string; // event identifier โ see the Events section
sessionId: string; // checkout session the form is rendering
intentId: string; // intent the session belongs to
payload?: object; // event-specific, see each event
}PaymentInfo is used as the payload by several events:
{
paymentId: string;
paymentMethod: FormPaymentMethodType; // e.g. "CARD"
paymentStatus: PaymentStatus; // e.g. "ACCEPTED"
}Events
Every event carries sessionId and intentId at the top level. Only payload varies between events.
type | sessionId | intentId | payload | Fires when |
|---|---|---|---|---|
SESSION_METADATA_SENT | โ | โ | โ | The iframe is ready โ use as a handshake. |
CHECKOUT_LOADED | โ | โ | โ | The form has rendered and is interactive. |
Examples
Updated 11 days ago
