Payments
Loader
overflow.js is the script that opens a checkout on your own page. It is about 5 KB, has no dependencies and does nothing until you ask it to.
<script src="https://overflowpay.net/v1/overflow.js" async></script>Load it from that address. Don't copy it into your bundle: the script works out where Overflow lives from its own URL.
What it does to your page
Nothing, until a checkout opens. On load the script defines window.Overflow and adds one click listener. It sets no cookies, reads and writes no local or session storage, and sends no requests.
When a checkout opens, the loader adds an <iframe> that points at Overflow. The payment form, the fraud checks and Stripe all run inside that frame, on Overflow's origin. So does the small proof-of-work puzzle the buyer's browser solves before the form shows. Your page's cookies, storage and DOM are out of their reach. See Privacy for the measurements.
Open a checkout
const checkout = Overflow.checkout({
id:"co_...",
mode:"modal",
on:{
success:({id,returnUrl}) => {
// the buyer finished. show a thank you, the webhook does the real work
},
close:() => {}
}
})
checkout.open()Options
| Option | Type | Notes |
|---|---|---|
id | string | A checkout id from your server. Give this or link. |
link | string | A pay link id (lnk_...) or its full address. Opens a fresh checkout for that link. |
mode | string | modal (default), drawer, inline or redirect. |
container | element or selector | Where the frame goes in inline mode. |
on | object | Event handlers, listed below. |
Modes
- modal: a centred dialog over your page. Escape or a click outside closes it, and focus returns to the button that opened it.
- drawer: the same dialog docked to the right edge, full height.
- inline: the frame is placed inside
containerand grows with its content. No overlay. - redirect: leaves your page for the full-page checkout. Use this as the fallback when a frame is not an option.
Methods
open() shows the checkout. close() and destroy() remove it.
Events
| Event | When | Payload |
|---|---|---|
ready | The payment form is on screen. | {id} |
success | The buyer paid. | {id, returnUrl} |
processing | The buyer finished, but the money hasn't arrived yet. Bank payments such as SEPA Direct Debit can take a few business days. success only follows if it clears while the checkout is still open, so rely on the payment.succeeded webhook to learn when it does. | {id} |
blocked | The fraud gate turned the buyer away. | {id} |
failed | A delayed payment failed. | {id} |
expired | The checkout expired before it was paid. | {id} |
close | The modal or drawer was closed. | none |
If you don't handle success and the checkout has a return_url, the loader sends the buyer there after a short pause.
Without writing JavaScript
Put an attribute on any button or link and the loader handles the click.
<button data-overflow-link="lnk_...">Buy the preset pack</button>
<button data-overflow-checkout="co_..." data-overflow-mode="drawer">Pay now</button>React
"use client"
import Script from "next/script"
export default function BuyButton() {
async function buy() {
const {id} = await fetch("/api/checkout",{method:"POST"}).then(res => res.json())
window.Overflow.checkout({id}).open()
}
return (
<>
<Script src="https://overflowpay.net/v1/overflow.js" />
<button onClick={buy}>Buy Pro</button>
</>
)
}Allowed sites
The checkout frame only loads on origins listed under Settings → Sites allowed to open the checkout. Anywhere else the browser refuses to render it. This stops another site from wrapping your checkout in its own page.
While Overflow runs in test mode, http://localhost and http://127.0.0.1 on any port are always allowed, so you can develop without changing settings.
Content Security Policy
If your site sends a CSP header, allow the loader and the frame:
script-src https://overflowpay.net;
frame-src https://overflowpay.net;Limits
- Cards and wallets complete inside the frame. Payment methods that send the buyer to their bank may need to leave the frame. If you rely on those, use
mode: "redirect". - Apple Pay only shows up inside a frame on your page once your site's domain is registered with Stripe on the platform's account. Ask the person who runs Overflow if you need it.
- Browsers block third-party frames in some private modes and extensions.
redirectmode always works.