Quick start
href is your normal checkout link (the one you get from Share). Use
?subscriptionId=… for a subscription. Any extra query parameters you already
use (such as customerEmail, clientReferenceId or your own metadata) are kept.
Without the script, or if it fails to load, the link still works: it simply
opens the checkout page.
Attributes
Either attribute may carry the checkout URL as its value
(
data-pocketsflow-checkout="https://…") when the element is not a link,
for example a <button> or a <div>. Elements added after the page loads
work too. Call Pocketsflow.refresh() to style buttons you add later.
Cmd/Ctrl-click and middle-click keep the browser’s normal “open in new tab”.
How the overlay behaves
- A centered dialog over a dimmed page, with a close button. Escape, the close button or a click on the backdrop closes it. Page scroll is locked while it is open, keyboard focus stays inside it, and focus returns to the button when it closes.
- A spinner shows until the checkout is ready. If the checkout cannot load within 15 seconds, the overlay offers Open checkout in a new tab.
- On screens narrower than 560px, the checkout opens in a new tab instead of an overlay.
- After a successful payment the overlay shows the buyer’s thank-you page, with their download. It stays open until the buyer closes it (or you close it).
- Apple Pay and Google Pay work in the overlay once your website’s domain is verified under Settings → Checkout. See Wallets on your own website.
Events
The script dispatches DOM events. They bubble from the clicked element, so you can listen onwindow or document.
Treat
pocketsflow:success as a signal for the page, not as proof of payment.
Fulfil orders from the order.completed webhook, which is signed. See
Webhooks.JavaScript API
The script exposeswindow.Pocketsflow:
Security
- The overlay accepts messages only from the checkout frame it opened, and only from that checkout’s origin. A message posted by anything else on the page is ignored.
- The checkout answers only the page that framed it, by its exact origin.
- Only the checkout and thank-you pages can be framed. The Pocketsflow dashboard cannot be shown inside another site.
Advanced: the JavaScript popup
The olderpocketsflow-popup.js integration (window.openPocketsflowCheckout,
inline embeds with embedDivId, onSuccess callbacks) keeps working. See
Checkout page. For new sites, embed.js is the
simpler choice.