Popup checkout
The same checkout in a popup over your own page, so the payer never leaves it. One script, one call, and your server still decides what is paid.
Volume's checkout opens two ways. The hosted page, paywithvolume.com/cs_…, is one you
send the payer to and they come back from. The popup is the same checkout drawn over
your own page: no redirect, no new tab, and the payer is back where they were when it
closes.
Both start the same way, from a checkout session your server creates. Anything you can open on the hosted page you can open in the popup, and the other way round.
1. Create the checkout on your server
As for the hosted page: an invoice, then a checkout session for it, with your secret key. Your page never sees the key, and never sets an amount, so it cannot change what is paid.
curl https://api.paywithvolume.com/v1/checkout_sessions \
-H "Authorization: Bearer $VOLUME_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"invoice_id": "inv_3Hf8QwZ1mKp7XnB2sLd9Vt4R",
"success_url": "https://pro.monierate.com/wallet",
"cancel_url": "https://pro.monierate.com/wallet"
}'Send the session's id (cs_…) to your page.
If your page already asked which coin, add pay_with to the same call, such as
"pay_with": { "asset": "USDT" }. The popup then opens on the payment itself, with no
wallet or coin to pick: see start at the payment.
Which sites may show it. Only your own. The popup may be opened by a page on the
site of the checkout's success_url or cancel_url, here https://pro.monierate.com.
To open it from one more site, pass that site's origin as popup_origin when creating
the checkout: a scheme and host, with no path, such as https://shop.example.com. It
must be https in live mode; in test mode it may be http://localhost:5173 while you
build. On any other site the checkout refuses to load.
2. Open it from your page
Load Volume's script once:
<script src="https://paywithvolume.com/v1/popup.js"></script>Then open the checkout session:
const popup = Volume.popup('cs_9Wd4Tn2KxR7bLq1MhV5sZp8C', {
onPaid({ checkoutSession, reference, status }) {
// The payment counted and the payer sees their receipt.
showMessage('Payment received — crediting your wallet…');
},
onClose({ checkoutSession, reason }) {
// completed, cancelled, dismissed or failed: see below.
waitForYourServer();
},
});Volume.popup returns { close() }. Only one popup is open at a time: opening another
closes the first. The popup covers the page, handles Escape and its own close button,
and gives focus back to your page when it closes.
What it tells you
| Callback | When | It carries |
|---|---|---|
onPaid | The payment counted: the checkout is paid and the receipt shows. The popup stays open on the receipt. | checkoutSession, reference (the payer's receipt reference), status: paid, overpaid or settled |
onClose | The popup closed. | checkoutSession, reason |
reason | What happened |
|---|---|
completed | The payer closed it from the receipt ("Back to …"). |
cancelled | The payer pressed Cancel payment before sending. |
dismissed | Escape, the close button, a click beside the checkout, or your own popup.close(). |
failed | The checkout never answered within 10 seconds. Almost always this site may not show it: check success_url, cancel_url and popup_origin. The browser console says so too. |
Count the payment on your server, never in the browser
onPaid is for your page to say something. It is not proof of payment: anything that
runs in a browser can be faked, and a payer can close the popup after sending and the
payment still lands minutes later. A closed popup, cancelled and dismissed included,
is not a failed payment.
So count it where you always would: on the invoice.paid webhook,
or by reading GET /v1/checkout_sessions/{id} from your server. After the popup closes,
have your page wait for your own server to say the order is paid, and keep a way to
reopen the checkout if it has not.
Good to know
- Reopening is safe.
Volume.popupwith the samecs_…shows the checkout as it stands: the same address and amount if they had started, or the receipt if it is paid, in which caseonPaidfires again. Make your handler safe to repeat. - When it cannot open,
failed, send the payer to the hosted page instead: the checkout session'surl. It takes the same payment. - Your Content-Security-Policy, if you set one, must allow
script-src https://paywithvolume.comandframe-src https://paywithvolume.com. - Test mode works the same. A test checkout in the popup has its Test mode panel, so you can pay it without real money and watch your callbacks and your webhooks. See test mode.
Fund a wallet: Monierate
How Monierate takes wallet top-ups in Bitcoin, Lightning, USDT and USDC from its own "Pay with" list, through Volume's popup checkout, from keys to going live, with Node.js you can copy. Any balance top-up works the same way.
Start at the payment
When your own app already asked how the payer pays, open Volume's checkout straight on the address or Lightning invoice for that coin.