Bitcoin checkout on Replit

Replit Agent builds web apps with an Express server and a Postgres database, and OpenReceive’s Express package runs in them as is. Your app’s own server code creates each Lightning invoice, the payment goes straight to your wallet, and payment attempts are stored in your app’s Postgres database. There is no OpenReceive account, no API key and no background worker.

Optional swaps let customers pay with USDT, USDC, SOL, and ETH. A swap provider you configure converts the payment to BTC over Lightning, and it settles into the same wallet. Available assets and networks depend on the provider.

Use @openreceive/* 0.4.19 or newer.

Before you start

Put both in the app’s Secrets, never in the chat. Secrets reach your server code as environment variables, and Replit links them to the published app.

Add checkout to your Replit app

  1. Open Tools → Secrets → New Secret. Add NWC_URI with your wallet code, then LSC_URI_PRIMARY with your swap provider code. Replit already gives every app a Postgres database in DATABASE_URL.

    The Secrets tool with a new secret named NWC_URI

  2. Send Replit Agent this prompt:

Add Bitcoin Lightning checkout to this app with OpenReceive. Download the
directions with your terminal and follow them exactly:

curl -fsSL https://openreceive.org/agent-directions/node/full.md

NWC_URI and LSC_URI_PRIMARY are already set as this app's Secrets, and the
server reads them from process.env. Do not ask me for them, and do not look
for them, check them or print them. Mount the payment routes on the Express
server and store payments in this app's Postgres database, through
DATABASE_URL. Create OpenReceive's tables when the server starts (the schema
SQL is idempotent), because a published Replit app gets its own production
database. Use @openreceive packages 0.4.19 or newer.
  1. If Agent offers to switch from Free to Power, choose Continue on Power. In Free mode Agent stops partway through this setup. On Power it took about 11 minutes in our test.

    Replit Agent recommending Power mode, with a Continue on Power button

The directions tell Agent how to map the three hooks onto your existing orders and how to render the checkout. Agent ends with “Setup is finished” and a link to try the checkout.

This prompt is for apps with a Node server, which is what Replit Agent builds by default. If your app’s server is Python, follow the FastAPI or Django quickstart instead.

Check it

In Preview, place an order. Its checkout shows the payment methods. Pick Bitcoin to see a Lightning invoice in sats. If the app stops at start, read the Console: usually NWC_URI is missing from Secrets, or the code is not receive-only.

The OpenReceive checkout in Replit's Preview, offering Bitcoin, USDT, USDC, SOL and ETH

Pay a small order from your wallet to see it settle: the checkout shows the payment as received, and onPaid marks the order paid.

Publish

  1. Select Publish. Under Advanced settings, keep Autoscale, and check that Deployment secrets lists NWC_URI (and LSC_URI_PRIMARY) with a link icon: Replit copies your Secrets into the published app. If you add a secret after publishing, check this list and republish.

    Publishing settings: Autoscale, and deployment secrets NWC_URI and LSC_URI_PRIMARY linked to the app's Secrets

  2. Select Publish and wait for “Your project is live”, about four minutes.

    Replit's message: Congratulations! Your project is live.

  3. Open the replit.app address, place an order and pick Bitcoin. A Lightning invoice appears.

    The published shop's checkout showing a Lightning invoice with its QR code and wallet list

The published app uses its own production database, separate from the one you build with. Replit can start it with a copy of your development data, and the server also creates OpenReceive’s tables there on its first start.

Start from the starter

The Express + Postgres starter is a one-product shop with checkout already wired, set up for Replit Autoscale. Its replit.md tells Agent how the payment code fits together, so you can ask for products, pages and design and keep checkout working. The README shows how to copy it into a repository of your own and import it into Replit.

How it runs on Replit

More detail: Express quickstart, Payment storage, Security.