The flow

  1. Playto.checkout() injects a modal containing an iframe to Playto’s checkout, scoped to your product. The iframe address carries only the id and the embed and env flags.
  2. The checkout asks playto.js where it is embedded. playto.js answers with your returnUrl, and the browser adds your site’s origin to that message. In Live, Playto checks that origin against your approved domains.
  3. The iframe collects the customer’s contact details.
  4. The payment form then opens in place, inside the same iframe. The customer types their card into the payment provider’s secure fields (see below), and never leaves Playto’s checkout to do it.
  5. When the payment ends, your page’s window goes to your returnUrl with the result appended. Usually the checkout tells playto.js, which closes the modal and sends the window there. Some payment providers (Whop) instead send the whole tab to Playto’s payment page when the payment completes. That page then sends it straight on to your returnUrl. Either way the customer ends on your returnUrl with the same result. Playto records the payment when the payment provider’s server-to-server webhook arrives.
  6. Playto.handleReturn() reads that result and fires onSuccess / onError.

Where the card is entered

The card fields are served by the payment provider and embedded in Playto’s checkout page. Playto does not hand the customer over to the provider’s own hosted page. How the fields look depends on the provider:
  • Stripe: Stripe’s embedded checkout form is mounted in the page.
  • Bolt: Bolt’s secure card fields are mounted in the page. The browser only tokenizes the card, and Playto’s backend charges that token.
  • Whop: Whop’s embedded checkout form is mounted in the page.
Because the fields live inside Playto’s checkout, typing the card does not navigate the tab away. The tab can still leave your page in two cases:
  • If a payment method has to send the customer elsewhere to approve the payment, Stripe’s embedded checkout redirects only when the method requires it, and the customer comes back to Playto afterwards.
  • After a completed Whop payment, Whop sends the whole tab to Playto’s payment page, which sends it on to your returnUrl (step 5 above).
Call Playto.handleReturn() on the page at your returnUrl. It reconstructs the result from the URL (playto_status and playto_session_id) once the customer arrives.

What gets sent back to your page

When the payment ends, the customer’s window goes to your returnUrl. Playto appends these query parameters to it: Playto.handleReturn() reads them and fires onSuccess for success and onError for failed or cancelled. By default it also removes them from the URL bar. The #hash in the URL is kept. If the customer closes the modal with the close button, nothing is appended and they stay on your page. Only your onClose callback fires.

The modal lifecycle (postMessage)

While the modal is open, playto.js and the checkout iframe exchange these messages: These are internal to the SDK. You interact only through the Playto.checkout callbacks.

Security model

  • No card data on your site. The card is typed into the payment provider’s secure fields embedded in Playto’s checkout, never into a field on your page.
  • The SDK validates the origin of every postMessage against Playto’s origin.
  • returnUrl is validated server-side to be a plain http(s) URL. In Live, the page that opens the checkout must be on an approved domain.
  • Your page address is not passed in the checkout’s URL or referrer. playto.js opens the checkout with no referrer and no merchant address in its URL. The checkout learns your site’s origin from the handshake above and keeps it in memory. Some browsers may still expose your site’s origin (not the full page address) to the iframe through location.ancestorOrigins.
  • Confirm fulfilment from the signed webhook, not just the browser callback — see Going live.