OpenReceive.AspNetCore
0.6.4
See the version list below for details.
dotnet add package OpenReceive.AspNetCore --version 0.6.4
NuGet\Install-Package OpenReceive.AspNetCore -Version 0.6.4
<PackageReference Include="OpenReceive.AspNetCore" Version="0.6.4" />
<PackageVersion Include="OpenReceive.AspNetCore" Version="0.6.4" />
<PackageReference Include="OpenReceive.AspNetCore" />
paket add OpenReceive.AspNetCore --version 0.6.4
#r "nuget: OpenReceive.AspNetCore, 0.6.4"
#:package OpenReceive.AspNetCore@0.6.4
#addin nuget:?package=OpenReceive.AspNetCore&version=0.6.4
#tool nuget:?package=OpenReceive.AspNetCore&version=0.6.4
OpenReceive.AspNetCore
Accept Bitcoin over Lightning in an ASP.NET Core app, paid straight into your own wallet. You connect the wallet with a receive-only Nostr Wallet Connect (NWC) code, and this package mounts the checkout routes in your app: it mints invoices, finds settlement, and calls your code once when an order is paid. There is no OpenReceive account, and OpenReceive never holds the funds.
OpenReceive also supports optional swaps from USDT, USDC, SOL, and ETH through a configured swap provider. The provider converts the payment to BTC over Lightning, which settles into the merchant's connected wallet. Available assets and networks depend on the provider; swaps are optional.
This package is the ASP.NET Core integration: AddOpenReceive<THost>(),
MapOpenReceive() and the openreceive commands (doctor, install,
reconcile, notifications, skills). It brings
OpenReceive, the engine. Your
app keeps its orders, users, prices and fulfillment; the engine keeps one
payment-attempt row per invoice in your own database.
Quickstart: https://openreceive.org/guides/quickstart-aspnetcore.md
Requirements
- .NET 10 (
net10.0). - An ADO.NET driver for your database:
Npgsql(PostgreSQL),MySqlConnector(MySQL 8 or MariaDB),Microsoft.Data.Sqlite(SQLite) orMicrosoft.Data.SqlClient(SQL Server, Azure SQL). With EF Core, its provider already brings it. - A receive-only NWC code in
NWC_URI(user-secrets in Development, the environment in production): https://openreceive.org/get_a_nwc_code_to_receive_payments. A swap provider's code goes inLSC_URI_PRIMARY: https://openreceive.org/set_up_swap_provider.
Install
dotnet add package OpenReceive.AspNetCore
Route the openreceive commands in Program.cs, after builder.Build():
using OpenReceive.AspNetCore;
var app = builder.Build();
// ...
app.MapOpenReceive("/openreceive");
if (await app.TryRunOpenReceiveCommandAsync(args)) return;
app.Run();
Then scaffold the host class and the migration for the engine's two tables:
dotnet run -- openreceive install
It writes OpenReceiveHost.cs (your three hooks, AuthorizeAsync,
AmountForAsync and OnPaidAsync, as marked placeholders) and either an EF
Core migration (when the app has a DbContext; dotnet ef database update
applies it) or a SQL file for your own migration tool, and prints the
registration line:
builder.Services.AddOpenReceive<OpenReceiveHost>(options =>
options.UseConnection(_ => new NpgsqlConnection(connectionString)));
dotnet run -- openreceive doctor reports every code as set or unset (never
its value), the host and any placeholder still in it, the prefix the routes are
mounted at, the tables, and the receive-only wallet preflight.
What it mounts
MapOpenReceive serves exactly the routes in
openreceive-http.v1.yaml
for the browser checkout (@openreceive/elements, or the standalone files on
every GitHub release): POST checkouts/prepare, checkouts,
payments/check, swaps/quote, swaps, swaps/status, swaps/refunds and
GET rates. The amount always comes from your AmountForAsync; a
payer-supplied amount is refused. At startup the engine checks that the NWC
code cannot spend and refuses to boot when it can.
OnPaidAsync runs inside the settlement transaction, once per order.
settlement.Session is that transaction: write through it, or let your EF
Core DbContext join it with db.Database.SetDbConnection(settlement.Session.Connection)
and db.Database.UseTransactionAsync(settlement.Session.Transaction), so the
order's state commits or rolls back with the payment record.
Commands
| Command | What it does |
|---|---|
openreceive doctor [--no-wallet] |
The install report; exits 1 on a failed check. |
openreceive install |
OpenReceiveHost.cs and the tables' migration (--context, --dialect, --sql, --namespace, --force). |
openreceive reconcile |
One gated settlement pass, for a cron job. |
openreceive notifications |
The optional worker: NWC-02 notifications plus a periodic pass. One per deployment. |
openreceive skills [--dir .claude/skills] |
Copies the OpenReceive agent skills into .agents/skills. |
dotnet App.dll openreceive doctor runs the same commands in a published app
or a container.
More
- Quickstart: https://openreceive.org/guides/quickstart-aspnetcore.md
- Payment storage and the attempt state machine: https://openreceive.org/guides/storage.md
- Authorization: https://openreceive.org/guides/authorization.md
- Swap refunds, before you set
LSC_URI_PRIMARY: https://openreceive.org/guides/swap-refunds.md - Source and issues: https://github.com/OpenReceive/openreceive
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- OpenReceive (>= 0.6.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.