OpenReceive for ASP.NET Core
Accept Bitcoin & Stablecoin Payments With ASP.NET Core
Add the OpenReceive package to your ASP.NET Core app, generate a host class and an EF Core migration, then render the checkout in a Razor page or your SPA. Your app keeps Identity, its DbContext and its orders; OpenReceive owns only payment attempts and settlement.
Package
Copy agent directions — Paste into Claude Code, Codex or Cursor to add OpenReceive to your ASP.NET Core app.
Why OpenReceive
- One install command.
dotnet run -- openreceive installwritesOpenReceiveHost.csfor your three hooks and one EF Core migration.dotnet ef database updateadds the two payment tables to the database your app already uses: PostgreSQL, MySQL, SQLite or SQL Server. - Your auth, your DbContext.
AuthorizeAsyncsees the sameHttpContext.Useras your pages. The host class is an ordinary scoped service: it can take yourDbContext, andOnPaidAsyncjoins the settlement's own transaction. - Checked at startup. When the app starts, the engine checks the NWC code with the wallet. A missing code, a dead relay or a code that can spend stops the deploy, not a customer's checkout.
- Stablecoins from user-secrets. Put a swap provider's code in
LSC_URI_PRIMARYand the engine builds the provider itself. Customers can then pay in USDT, USDC, ETH or SOL, and you still receive Bitcoin.
Try the checkout your customers will see
In an ASP.NET Core app this checkout is one <openreceive-checkout> tag in a Razor page, talking to the routes MapOpenReceive mounts at /openreceive. The repository's ASP.NET Core starter is a small shop built the same way. The live demo needs JavaScript: open the OpenReceive home page.
Four steps
Requires .NET 10, and an ADO.NET driver for PostgreSQL, MySQL, SQLite or SQL Server.
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. Install the plugin
dotnet add package OpenReceive.AspNetCore
4. Connect the wallet — Save the NWC code where the ASP.NET Core quickstart says, and add the LSC code to switch swaps on.
Full ASP.NET Core quickstart · Example shop
How it runs
- Tested on
- .NET 10
- Databases
- PostgreSQL, MySQL 8, SQLite and SQL Server
- Secrets
- NWC_URI, and LSC_URI_PRIMARY for swaps, in user-secrets, environment variables or .env under Compose, never in appsettings.json or 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. When an order's first payment settles, the engine calls OnPaidAsync in your host class inside the settlement transaction. Mark the order paid there, and send mail from AfterPaidAsync, which runs after the commit. ASP.NET Core quickstart
- 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?
- .NET 10, the ADO.NET driver for your database, NWC_URI in the server's environment or configuration provider (never appsettings.json), and the generated migration applied with dotnet ef database update. No cron or worker is required: settlement runs on the mounted routes, and the notifications worker is optional for faster confirmation. ASP.NET Core quickstart
Add OpenReceive to ASP.NET Core
Copy agent directions · Full quickstart · Example shop · API reference · Guides