/preview endpoint renders a fully interactive checkout page backed by a stub session — no database round-trip, no API keys required. It is designed for embedding inside a dashboard theme editor so merchants can see appearance changes in real time.
URL
The sandbox preview serves the same stub session and accepts the same
postMessage appearance updates as production — it’s purely a visual preview either way. Whichever URL you embed, make sure the postMessage target origin (the second argument to iframe.contentWindow.postMessage) matches that URL exactly. Messages sent with a mismatched target origin are dropped silently.Embed as an Iframe
Sending Appearance Updates
Once the preview iframe loads, send appearance changes viapostMessage. The preview page listens for ozura-preview-appearance messages and applies them live using the same applyAppearanceConfig function used by real checkout sessions.
Appearance Message Shape
Ready Event
The preview page firesozura-preview-ready as soon as it mounts. Listen for this event before sending appearance updates to avoid messages being dropped before the listener is registered.
Stub Session
The preview runs against a fixed in-memory session:
The Pay button is rendered and interactive but will fail gracefully if clicked — there is no real vault key or payment processor connection. This is intentional: the preview is for visual inspection only.
Limitations
- Cannot test actual payments
successUrl,cancelUrl,errorUrlare set to#— no redirect occurs- The session ID is
"preview"— it does not exist in the database - Changes made via
postMessageare in-memory only and reset on page reload - The preview page ignores messages from opaque origins (
null,file://, sandboxed iframes). The parent page must be served over HTTP/HTTPS with a real origin forpostMessageto be accepted. The preview pins to the first origin it receives a message from — subsequent messages from a different origin are dropped.