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. PaymentInfo (used as payload by several events):
{
paymentMethod: CARD,
paymentId: string,
paymentStatus: AUTHORIZED,
}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. |
Updated 39 minutes ago
