Skip to main content
@warpfi/react shows the hosted Warp checkout on your page: inline, in a modal or in a popup. It needs React 18 or later and works with Next.js (App Router and Pages Router). npm · GitHub

Install

The components are client components ('use client'). Your server creates the session with the Node.js SDK and returns its checkout_url. For a complete Next.js walkthrough, see Set up with examples.

Inline checkout

fetchCheckoutUrl is called once per mount. If you already have the URL, pass checkoutUrl instead. The iframe resizes to its content. It remounts when checkoutUrl, theme or checkoutOrigin change; changing callbacks never remounts it. <PayWithWarpButton> creates the session when clicked and opens the checkout in a full-screen modal. It is disabled and aria-busy while loading.
The modal closes on Escape, the backdrop or the close button (calling onCancel if the payment has not completed), and after the customer cancels or returns from the success page. onClose is called last every time it closes.
Use popup where your page cannot frame the checkout, and redirect to send the customer to the hosted page. The popup opens synchronously from the click; if the browser blocks it anyway, onError receives popup_blocked.

Hook

useWarpCheckout gives you the modal and popup behind your own UI:
Call openPopup directly in the click handler, without awaiting anything first. The returned functions are stable. Opening again closes the previous checkout, and unmounting closes it too.

Props

<WarpCheckout> <PayWithWarpButton> takes fetchCheckoutUrl (required), mode ('modal' default, 'popup' or 'redirect'), theme, checkoutOrigin, the same callbacks plus onClose, children and any <button> props. useWarpCheckout(options) takes checkoutUrl or fetchCheckoutUrl, theme, checkoutOrigin and the callbacks plus onClose. It returns { openModal, openPopup, close, status, sessionId, isOpen, isLoading, error }.

Exports

Callbacks are UI signals only. Fulfil orders from the payment.completed webhook or a server-side session lookup.