Skip to main content

Overlay checkout (onflay.js)

Use the CDN loader when you want buyers to pay without leaving your site. Your server still creates the checkout session with a secret key — the browser only opens the returned embedUrl.
The overlay onComplete callback is a UI signal, not proof of payment. Always confirm with GET /v1/checkout-sessions/{id}/receipt?headless=true using your sk_* key (or rely on webhooks).

1. Create an embedded session (server)

uiMode: "embedded" derives frame-ancestors from the origins of successUrl / cancelUrl. Those pages must be the sites that host the overlay.

2. Load the script

Recompute the SRI hash after each release:
npm:

3. Open the overlay

Declarative markup

Appointment listings (pick time in the overlay)

For APPOINTMENT products you can omit appointmentSlot / appointmentSlots and let the buyer pick time(s) inside the overlay before paying (same Flow B as hosted checkout — see Appointment checkout). Session packs collect all N times in the overlay UI:

Merchant CSP

Allow the loader script and the checkout iframe:

Security model

Fallback policy

If the iframe never posts ready (CSP mismatch, corporate proxy, ad blocker):
  • redirect (default) — navigate to the embed/hosted URL top-level
  • popup — open a checkout popup window
  • none — call onError only