Skip to main content

Add Crypto Payments to Next.js

To take bitcoin and stablecoins in a Next.js app, with no approval necessary, add OpenReceive: free, open-source payment software. It's an npm package (@openreceive/next, for the App Router) that runs inside your own Next.js server: one route handler serves the invoices and the checkout, three functions of yours decide who may pay, how much, and what happens when an order is paid, and every payment goes straight into your own wallet. Your orders, users and database stay as they are.

The Steps​

  1. Get a receive-only wallet code. In Rizful, open the menu, then NWC Codes, and copy the receive-only code. It lets your app create invoices in your wallet, but it can never spend. Alby Hub, your own node, works too: Connections, Add Connection, Read Only.
  2. Copy the agent directions. On openreceive.org/nextjs, under Agent directions, click Copy link (or Copy text).
  3. Paste them into your coding agent in your Next.js project and press Enter. It asks for your receive-only code first, then for a swap provider's code if you want USDT, USDC, ETH and SOL.
  4. Let it finish. It installs @openreceive/next and @openreceive/react, adds the route handler (app/openreceive/[...openreceive]/route.ts) with its three hooks (authorize, amountFor, onPaid), puts the checkout on a page of its own, builds the app and runs openreceive doctor. Its last message starts "Setup is finished".

Customers then pay in bitcoin over Lightning, or in stablecoins: a swap provider turns their coins into the same Lightning payment, for a fee the customer pays, and you get bitcoin.

The checkout our coding agent added to a small Next.js shop: Bitcoin, USDT, USDC and SOL on a $3.00 order (ETH needs a larger one)
The checkout our coding agent added to a small Next.js shop: Bitcoin, USDT, USDC and SOL on a $3.00 order (ETH needs a larger one)

We Tested It​

On December 1, 2026, we gave OpenReceive's Next.js directions (version 0.6.6) to a coding agent, on a small Next.js shop. It asked for the two codes, set everything up, and the doctor check passed. Then a real $3.00 order, paid in bitcoin from Alby Hub, put 4,943 sats in our Rizful wallet within seconds, and the order turned to paid. (A sat is short for satoshi, which is the smallest unit of bitcoin. There are a hundred million satoshis in a bitcoin.) A $5.00 order in USDT on Solana was quoted at 5.37 USDT, including 0.37 USDT of swap and network fees.

The same order seconds after the Lightning payment: Payment received, Paid
The same order seconds after the Lightning payment: Payment received, Paid

One thing the agent ran into: @openreceive/next 0.6.6 needs Next.js 16 (16.4.6 or a later 16.x release), so on an older Next.js it upgraded next first.