Skip to main content
This guide adds an embedded checkout to your app in four steps. Each step has an example for Next.js (React), Nuxt (Vue) and Express with plain JavaScript. Pick one stack and follow its tab all the way down.

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

Add your keys to the server environment, for example in .env.local (Next.js) or .env (Nuxt, Express). Never commit this file.
.env
Create one shared client on the server:
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.
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 fetchCheckoutUrl function that calls your endpoint. Use the inline checkout, or a button that opens it in a modal.
app/checkout/[orderId]/checkout.tsx
app/checkout/[orderId]/page.tsx
The components are client components. More options: React SDK.
onComplete is a UI signal so you can update the page. Anyone can trigger it from the browser console. Never fulfil an order from it: use the webhook in the next step.
4

Confirm the payment with a webhook

Warp sends 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.
app/api/webhooks/warp/route.ts
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 warp.checkout.sessions.retrieve(id) and check that status is completed.

Test it

  1. Start your app on http://localhost with your sk_test_ key.
  2. Open the checkout page. The checkout loads inside your page.
  3. Pay with your testnet wallet. onComplete fires when the payment is confirmed.
  4. Check that your webhook handler marked the order as paid. To reach a local server from Warp, use a tunnel such as ngrok or cloudflared and set its URL as the webhook endpoint for your test project.
To unit-test your webhook handler without Warp, sign your own payloads with generateTestHeader:

Troubleshooting

Going live

  • Replace sk_test_ with your sk_live_ key and the live webhook signing secret.
  • Make sure return_url and cancel_url use 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.