For a step-by-step setup with full Next.js, Nuxt and Express examples, see Set up the SDKs.
How it works
1
Create a session on your server
Create the session with your secret key, as usual, and set
return_url or cancel_url to a page on the site that embeds the checkout. Return checkout_url to the browser.2
Embed it
Pass the URL (or a function that fetches it) to the component. It loads the checkout in an iframe, modal or popup.
3
React to events
The checkout reports
ready, status changes, completion, cancel and return. Use them to update your UI.Server
The browser never sees your secret key. This example uses the Node.js SDK:Client
- React
- Vue
- JavaScript
- Script tag
useWarpCheckout(options) returns openModal, openPopup, close, status, sessionId, isOpen and error for custom buttons.Display modes
All modes accept
theme (light, dark or auto). Match it to your page so the iframe background blends in.
Events
In embed mode the cancel and return buttons send events instead of navigating, so your page decides what happens next.
Allowed origins
The checkout can only be framed by, and only sends events to, the origins of the session’sreturn_url and cancel_url. Testnet sessions (created with an sk_test_ key) also allow http://localhost and http://127.0.0.1 on any port, for local development.
- Set
return_urlorcancel_urlto a page on the site that embeds the checkout. A session without either cannot be embedded; redirect tocheckout_urlinstead. - If your site sends a Content-Security-Policy, add
frame-src https://checkout.usewarp.net. - For popups, do not send
Cross-Origin-Opener-Policy: same-origin; usesame-origin-allow-popups.
Next steps
Webhooks
Confirm payments on your server.
Node.js SDK
Create sessions and verify webhooks.
Set up with examples
Full Next.js, Nuxt and Express walkthroughs.
SDK overview
Every package with npm and GitHub links.