Skip to main content
Embed Waftpay checkout directly in your page instead of redirecting away. The checkout runs in an iframe on Waftpay’s domain — card and payment details never touch your page — and a small loader script gives you a JavaScript API over it.
You still create the request token on your server, exactly as for the redirect flow. The only difference is how the customer reaches the page. Never generate the token in the browser.
Want to see a full integration first? Try the WaftStore demo →, a sample store that creates a session and opens this checkout.

Quick start

Add the loader script, then mount the checkout with the token your server created.
The checkout opens as a centered card over a blurred overlay; your page stays visible behind it.

Confirm payments on your server

onSuccess is a UI event, not proof of payment. It is a postMessage from a frame, and anyone who can open your page can send one. Treat it purely as a signal to update the UI. Before you fulfil an order, ship goods, or credit an account, confirm the transaction server-side — via your webhook callback, which remains the source of truth.

Waftpay.mount(options)

It returns a handle:
Pressing Esc also asks the checkout to close.

The redirect rule

When a payment resolves, Waftpay produces a success or failure redirect URL. What the loader does with it depends on whether you passed a callback:
  • If you supplied onSuccess (or onFailure), we assume you want to stay on your page — your callback fires and the overlay closes. No navigation.
  • If you did not, the loader navigates your top-level page to the redirect URL — matching the hosted redirect flow.
So a single-page app just supplies callbacks; a traditional page supplies none and gets the classic redirect.

Events

Every event is delivered to onEvent in raw form (and to the matching on* callback).
partial: true on waft:success means the payer settled only part of the total. The overlay deliberately stays open so they can pay the remainder.

Raw iframe (fallback only)

For environments that can’t run our script — some WebViews, or sites that block third-party JavaScript — embed the frame directly:
  • Pass your exact origin as ?origin=, or events cannot be delivered to you.
  • Implement the postMessage handling yourself, and validate event.origin against https://checkout.waftpay.io on every message.
Prefer the loader script wherever you can — the raw /embed/<token> URL is a frozen contract and won’t gain new behaviour.

Current limitations

  • Overlay only. The checkout mounts as a centered card over a blurred scrim; in-flow (“inline”) embedding is not yet supported.
  • Domain allowlisting is not yet enforced. During the pilot any origin may frame the checkout. When per-merchant domain registration ships, you’ll need to register the domains you embed from — watch for that announcement.