The flow
Playto.checkout()injects a modal containing an iframe to Playto’s checkout, scoped to your product. The iframe address carries only the id and theembedandenvflags.- 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. - The iframe collects the customer’s contact details.
- 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.
- When the payment ends, your page’s window goes to your
returnUrlwith 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 yourreturnUrl. Either way the customer ends on yourreturnUrlwith the same result. Playto records the payment when the payment provider’s server-to-server webhook arrives. Playto.handleReturn()reads that result and firesonSuccess/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.
- 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 yourreturnUrl. 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
postMessageagainst Playto’s origin. returnUrlis validated server-side to be a plainhttp(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.
