Skip to main content
@warpfi/js shows the hosted Warp checkout on any page, with no framework and no dependencies. Use it as an ES module, from a <script> tag, or as the <warp-checkout> web component. The React and Vue SDKs are built on it. npm · GitHub · CDN

Install

Your server creates the session with the Node.js SDK and returns its checkout_url. For a complete Express walkthrough, see Set up with examples.

Inline checkout

You can pass checkoutUrl instead of fetchCheckoutUrl if you already have it. The iframe resizes to its content.

Script tag

The CDN build exposes window.Warp (mountCheckout, openCheckoutModal, openCheckoutPopup) and registers <warp-checkout>.
The modal closes on Escape, a backdrop click or the close button (calling onCancel if the payment has not completed), and after onCancel or onReturn from the checkout page. onClose is called last. Use a popup when the checkout cannot run in a frame on your page. Call it directly in a click handler: the window opens immediately and loads the checkout once fetchCheckoutUrl resolves.
If your page sends Cross-Origin-Opener-Policy, use same-origin-allow-popups so the popup can report back.

Web component

Attributes: checkout-url (required), theme and checkout-origin. Changing an attribute remounts the checkout; removing the element tears it down. Events: warp:ready, warp:status (detail.status), warp:complete, warp:cancel, warp:return and warp:error (detail.error).

Options

Each function resolves to a CheckoutInstance with sessionId, status and an idempotent destroy(). Setup errors are passed to onError and also reject the promise.

Exports

Security

The SDK accepts a message only from checkoutOrigin, from the exact iframe or popup it opened, with the expected shape, protocol version and session id. The iframe is sandboxed so it cannot navigate your page.
Callbacks are UI signals only: anyone can call them from the browser console. Fulfil orders from the payment.completed webhook or a server-side session lookup.