Skip to content

Examples ​

Static playground (live demo) ​

examples/playground is a Vite page. The server runs in the browser with mock providers, so it needs no backend and no secrets. The docs site hosts it. See Live demo (playground).

Next.js playground ​

examples/next-demo is a Next.js App Router app with a playground. You pick the flow (deposit or withdraw), the user's country, the destination, who holds the funds, the wallet, the theme and the accent color, and the widget restarts with a new session. The page also shows the widget events and the webhooks your backend received.

Playground

Run these commands from the root of a clone of the repository:

bash
pnpm install
pnpm build         # the examples import the built packages (dist)
cp examples/next-demo/.env.example examples/next-demo/.env.local
pnpm dev:example   # http://localhost:3000
VariableDefaultDescription
OPENRAMP_SECRETa dev value32+ characters
PUBLIC_URLhttp://localhost:3000Used for baseUrl and the webhook URL
OPENRAMP_MOCK11: mock providers only, works offline. 0: real Relay for wallet and transfer, mock fiat.
NEXT_PUBLIC_WALLETCONNECT_PROJECT_IDemptyOnly browser wallets work without it
OPENRAMP_WEBHOOK_SECRETa dev valueSigns the webhooks to /api/hooks. A Standard Webhooks secret (whsec_..., from generateWebhookSecret()). Not in .env.example: add it for a real deployment.
XENDIT_SECRET_KEY, XENDIT_WEBHOOK_TOKENemptyAdds real Xendit merchant pay-in when both are set
CRON_SECRETemptyProtects /api/cron. In production, the route refuses all calls when it is not set.
RELAY_API_KEYemptyRelay API key, for OPENRAMP_MOCK=0. Relay requires it for quotes under its announced policy from 2 Oct 2026; some requests without a key may still work today, but Relay can refuse them at any time. Also needed for deposit address status (/requests/v2 retires on 2026-11-24).
OPENRAMP_ADMIN_TOKENempty32+ characters. Turns on the admin tools and the ops dashboard at /api/openramp/admin.

What to look at:

FileShows
lib/openramp.tscreateOpenRamp with mock (including offramp: true), Relay and Xendit adapters, webhooks, and the withdraw hooks screenAddress and treasury
app/api/openramp/[...path]/route.tsMounting the handler with nextHandlers()
app/api/deposit-session/route.tsCreating a session in your backend
app/api/withdraw-session/route.tsCreating a withdraw session with source, custody and allowedDestinations
app/api/cron/route.ts, vercel.jsonThe background sweep as a Vercel Cron Job, checked with CRON_SECRET
app/api/hooks/route.tsVerifying webhooks with openramp.webhooks.verify
components/Playground.tsxOpenRampProvider, DepositButton, WithdrawButton, OpenRampEmbedded, themes, createMockWallet, wagmiWallet
e2e/deposit.spec.ts, e2e/withdraw.spec.tsPlaywright flows on desktop, Android and iPhone
e2e/screens.spec.tsScreenshot capture

Flows to try:

SetupFlow
Vietnam, Token on MonadVietQR, then a mock bridge hop: a two-leg pathway
Singapore, USDC on BaseCard by a popup-safe redirect to a hosted checkout
United States, mock walletPay with wallet (WALLET_TX)
Germany, no walletTransfer crypto to a deposit address
Indonesia, Merchant fiat accountQRIS pay-in, no crypto
Philippines, embedded offModal mode; a bottom sheet on phones
Withdraw, United States, mock walletTo wallet: USDC on Base to an Arbitrum address
Withdraw, Philippines, mock walletTo cash: a GCash payout through the mock offramp
Withdraw, app holds the fundsThe demo treasury sends instead of the wallet
Pay from walletConfirm in walletTransfer: pick a sourceDeposit address
Card redirectMock hosted checkoutProcessingCrypto methods

Nuxt (Vue) ​

examples/nuxt-demo is a minimal Nuxt 4 app with @openrampkit/vue. It has the server, a session route and a deposit button, with mock providers only.

bash
pnpm install && pnpm build   # from the repository root, once
pnpm --filter nuxt-demo dev  # http://localhost:3000
FileShows
server/utils/openramp.tscreateOpenRamp with the mock adapter
server/api/openramp/[...path].tsMounting the handler with openramp.handle(toWebRequest(event))
server/api/deposit-session.post.tsCreating a session in your backend
app/app.vueOpenRampProvider and DepositButton

SvelteKit (Svelte) ​

examples/sveltekit-demo is a minimal SvelteKit 3 app (Svelte 5) with @openrampkit/svelte. It has the server, a session route and a deposit button, with mock providers only.

bash
pnpm install && pnpm build        # from the repository root, once
pnpm --filter sveltekit-demo dev  # http://localhost:3000
FileShows
src/lib/server/openramp.tscreateOpenRamp with the mock adapter
src/routes/api/openramp/[...path]/+server.tsMounting the handler with openramp.handle(request)
src/routes/api/deposit-session/+server.tsCreating a session in your backend
src/routes/+page.sveltesetOpenRamp and use:depositButton

SolidStart (Solid) ​

examples/solidstart-demo is a minimal SolidStart 2 app with @openrampkit/solid. It has the server, a session route and a deposit button, with mock providers only. SolidStart 2 needs Node.js 24 or later.

bash
pnpm install && pnpm build         # from the repository root, once
pnpm --filter solidstart-demo dev  # http://localhost:3000
FileShows
src/lib/openramp.server.tscreateOpenRamp with the mock adapter
src/routes/api/openramp/[...path].tsMounting the handler with openramp.handle(event.request)
src/routes/api/deposit-session.tsCreating a session in your backend
src/routes/index.tsxOpenRampProvider and DepositButton

Cloudflare Worker ​

examples/cloudflare-worker runs the server as a standalone Worker with a Durable Object session store (durableObjectStore). Your app backend creates sessions over HTTP with a shared API key, through the authorize hook. See Deploy on Cloudflare Workers.

bash
pnpm install && pnpm build   # from the repository root, once
cd examples/cloudflare-worker
cp .dev.vars.example .dev.vars
pnpm dev   # wrangler dev on http://localhost:8787

curl -X POST http://localhost:8787/sessions -H 'x-app-key: dev-app-key' -H 'content-type: application/json' \
  -d '{"userId":"u1","country":"VN","destination":{"type":"crypto","chain":"eip155:8453","token":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","address":"0x000000000000000000000000000000000000beef"}}'

Web component demo ​

packages/web has a Vite demo of the bare element (pnpm --filter @openrampkit/web demo).

Agent (MCP) ​

examples/agent shows an AI agent that funds a wallet through @openrampkit/mcp. A script calls the MCP tools like an agent. It creates a deposit session, shows the pay link, and waits until the payment completes. The README has the Claude Desktop and Claude Code config. See Agents (MCP).

bash
pnpm build
node examples/agent/agent.mjs           # a script plays the person
node examples/agent/agent.mjs --serve   # you open the pay link in a browser

MIT licensed