Skip to main content
The /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

No authentication headers are required. The page is publicly accessible.
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 via postMessage. The preview page listens for ozura-preview-appearance messages and applies them live using the same applyAppearanceConfig function used by real checkout sessions.
Always specify the target origin ('https://checkout.ozura.com') as the second argument to postMessage. Passing '*' allows any page to intercept the message.

Appearance Message Shape

Ready Event

The preview page fires ozura-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, errorUrl are set to # — no redirect occurs
  • The session ID is "preview" — it does not exist in the database
  • Changes made via postMessage are 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 for postMessage to be accepted. The preview pins to the first origin it receives a message from — subsequent messages from a different origin are dropped.

Full Integration Example