Before you start
- A Warp Platform project with a receiving address for testnet payments.
- The project’s test secret key (
sk_test_...). - A webhook endpoint configured in the Platform, and its signing secret. You can add this in step 4.
- A testnet wallet, as described in the Quickstart.
1
Install and configure
- Next.js
- Nuxt
- Express + JavaScript
.env.local (Next.js) or .env (Nuxt, Express). Never commit this file..env
lib/warp.ts
sk_test_ keys create testnet sessions; switch to sk_live_ when you go live. The constructor throws in a browser, so import this file from server code only.2
Create a checkout session on your server
The browser asks your server for a session. Your server takes the amount from its own records, creates the session and returns
checkout_url.- Next.js
- Nuxt
- Express + JavaScript
app/api/checkout/route.ts
return_url and cancel_url must be on the site that embeds the checkout: their origins are the only ones allowed to frame it. Testnet sessions are also allowed on http://localhost and http://127.0.0.1, so this works in local development as is. See Allowed origins.3
Show the checkout
Each client SDK takes a The components are client components. More options: React SDK.
fetchCheckoutUrl function that calls your endpoint. Use the inline checkout, or a button that opens it in a modal.- Next.js
- Nuxt
- Express + JavaScript
app/checkout/[orderId]/checkout.tsx
app/checkout/[orderId]/page.tsx
4
Confirm the payment with a webhook
Warp sends Respond with a 2xx quickly; Warp retries other responses. Events, payloads and the retry schedule are in Webhooks. If you cannot receive webhooks, retrieve the session on your server with
payment.completed to your webhook URL when the payment is confirmed on-chain. Verify the signature against the raw body, skip events you have already handled, then fulfil the order.- Next.js
- Nuxt
- Express + JavaScript
app/api/webhooks/warp/route.ts
warp.checkout.sessions.retrieve(id) and check that status is completed.Test it
- Start your app on
http://localhostwith yoursk_test_key. - Open the checkout page. The checkout loads inside your page.
- Pay with your testnet wallet.
onCompletefires when the payment is confirmed. - Check that your webhook handler marked the order as paid. To reach a local server from Warp, use a tunnel such as
ngrokorcloudflaredand set its URL as the webhook endpoint for your test project.
generateTestHeader:
Troubleshooting
Going live
- Replace
sk_test_with yoursk_live_key and the live webhook signing secret. - Make sure
return_urlandcancel_urluse your production origin over HTTPS. - Fulfil orders only from the webhook or a server-side session lookup.
- Store processed event ids so retried webhooks are not handled twice.
Next steps
Embedded checkout
Display modes, events and allowed origins.
Webhooks
Events, payload, signatures and retries.
Node.js SDK
Sessions, pagination, errors and ZK proofs.
SDK overview
All packages with npm and GitHub links.