OpenReceive for SvelteKit

Accept Bitcoin & Stablecoin Payments With SvelteKit

OpenReceive has no SvelteKit package, and needs none. One +server.ts route hands each request to OpenReceive's web-standard handler, the Svelte checkout component draws the page, and the payment attempts live in your Postgres database.

Recipe

Read the SvelteKit recipe

Why OpenReceive

Try the checkout your customers will see

The live demo needs JavaScript: open the OpenReceive home page.

Set up

Requires Node ≥ 22, SvelteKit with @sveltejs/adapter-node.

1. Get a receive-only NWC code — get one here. It can issue invoices and watch for payment, and it can never spend from your wallet.

2. Get an LSC code for swaps (optional) — from a swap provider, only if customers should be able to pay in USDT, USDC, ETH or SOL.

3. Set the environment variables — NWC_URI (required) and LSC_URI_PRIMARY / LSC_URI_BACKUP (optional) in the environment of your SvelteKit server process; see Environment variables.

4. Install

npm install @openreceive/http @openreceive/svelte pg

5. Follow the recipe — Add the payment route and the checkout page. The recipe has the code, the database tables and the settings.

Read the SvelteKit recipe

How it runs

Tested on
Node, checked with SvelteKit 3.0, adapter-node 6 and OpenReceive 0.4.25
Databases
PostgreSQL
Secrets
NWC_URI, and LSC_URI_PRIMARY for swaps, in the server's environment or .env file, never in browser code
Refunds
Refund a settled Lightning payment from your own wallet: the wallet code is receive-only. A swap deposit that never converted goes back to the payer through the checkout's refund form.
Mobile apps
No app SDK. A mobile app opens your checkout page in a browser tab, which the app stores allow for physical goods and real-world services; digital goods need a link-out program.

Practical questions

Which currencies can customers pay with?
Bitcoin over Lightning, always. With a swap provider configured, also USDT on Tron, Solana or Ethereum, USDC on Solana or Ethereum, ETH and SOL, each converted into the same Lightning payment. Automated swaps guide
Where does the Bitcoin go?
Into the wallet behind your NWC code. OpenReceive never holds funds: the invoice is minted in your wallet and the sats land there. Your server confirms settlement and runs your onPaid hook once per order. Payment storage guide
What wallet do I need?
Any wallet that issues receive-only NWC (Nostr Wallet Connect) codes, hosted or self-run. The code must be able to create invoices and read their status, and must not be able to spend. Get a receive-only NWC code
What does it cost?
OpenReceive is open source and free. Fees charged by your wallet provider, by a swap provider or by Lightning routing belong to those services and are outside OpenReceive's scope.
What do I need to deploy?
Node 22 or later with @sveltejs/adapter-node, a Postgres database, NWC_URI in the server environment, and OpenReceive's two payment tables. SvelteKit recipe

Add OpenReceive to your SvelteKit app

Read the SvelteKit recipe · API reference · Guides