OpenReceive for Nuxt

Accept Bitcoin & Stablecoin Payments With Nuxt

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

Package

Tested live · Nov 26, 2026 · 0.6.1

Copy agent directions — Paste into Claude Code, Codex or Cursor to add OpenReceive to your Nuxt app.

Why OpenReceive

Try the checkout your customers will see

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

Six steps, real code

Requires Node ≥ 22, Nuxt 4 on Nitro's node-server preset.

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 Nuxt server process; see Environment variables.

4. Install

npm install @openreceive/nuxt pg

5. Wire OpenReceive — quoted from the Nuxt quickstart.

// server/openreceive.ts
import { defineOpenReceive } from "@openreceive/nuxt/server";

export default defineOpenReceive({
  storage: {
    db, // your existing pg Pool, from server/utils/db.ts
    // Runs once, inside the transaction that records the payment.
    onPaid: async ({ reference, paidAt, query }) => {
      await query(
        "UPDATE orders SET state = 'paid', paid_at = $1 WHERE id = $2 AND state = 'awaiting_payment'",
        [paidAt, reference],
      );
    },
  },
  // The price comes from the order row, never from the request.
  amountFor: async (reference) => {
    const order = await findOrder(reference); // your own orders
    return order?.state === "awaiting_payment"
      ? { currency: order.currency, value: order.amount, description: order.title }
      : null;
  },
  // Only the buyer may pay for their order.
  authorize: async ({ native, resource }) => {
    const order = resource.reference ? await findOrder(resource.reference) : undefined;
    return Boolean(order && order.visitor === getCookie(native, "visitor"));
  },
  // 60 new invoices an hour per client IP, counted in your database.
  rateLimiting: true,
});

6. Render the checkout

<!-- app/pages/checkout/[reference].vue -->
<script setup lang="ts">
const route = useRoute();
// During server rendering, useFetch passes the visitor's cookies to your own routes.
const { data, error } = await useFetch(`/api/checkout/${route.params.reference}`);
if (error.value) {
  throw createError({ statusCode: 404, statusMessage: "Not found", fatal: true });
}
let saved = data.value?.swapPaymentHash; // the order row's swap_payment_hash

// With swaps on: keep a new swap's payment hash on the order row.
function onState(event: Event) {
  const { state } = (event as CustomEvent).detail;
  if (state.rail !== "swap" || !state.payment_hash || state.payment_hash === saved) return;
  saved = state.payment_hash;
  $fetch(`/api/orders/${data.value?.reference}/swap-hash`, {
    method: "POST",
    body: { payment_hash: saved },
  });
}
</script>

<template>
  <OpenReceiveCheckout v-if="data" :reference="data.reference" resumable
    :resume-payment-hash="data.swapPaymentHash" :on-state="onState" />
</template>

Full Nuxt quickstart · Example app

How it runs

Tested on
Node 22: Nuxt 4.7 (Nitro 2) in tests/nuxt, and agent trials
Databases
PostgreSQL, directly or through a transaction pooler, MySQL 8, MariaDB 11 and SQLite
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 completely free and open source (MIT). For Bitcoin Lightning payments, every listed NWC provider charges 0% to receive; for stablecoin, ETH and SOL payments, your payer pays the swap provider's fee, not you. See full pricing & fee breakdown
What do I need to deploy?
Node 22 or later on Nitro's node-server preset, a Postgres database, NWC_URI in the server environment, and OpenReceive's two payment tables. Nuxt recipe

Add OpenReceive to your Nuxt app

Copy agent directions · Full quickstart · Example app · API reference · Guides