Xrpl.X402.AspNetCore 1.0.0

dotnet add package Xrpl.X402.AspNetCore --version 1.0.0
                    
NuGet\Install-Package Xrpl.X402.AspNetCore -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xrpl.X402.AspNetCore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xrpl.X402.AspNetCore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Xrpl.X402.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xrpl.X402.AspNetCore --version 1.0.0
                    
#r "nuget: Xrpl.X402.AspNetCore, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xrpl.X402.AspNetCore@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xrpl.X402.AspNetCore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Xrpl.X402.AspNetCore&version=1.0.0
                    
Install as a Cake Tool

Xrpl.X402.AspNetCore

Server-side of x402 (HTTP-402) agentic payments for the XRP Ledger. Protect an ASP.NET Core endpoint so it requires an XRPL payment (XRP or RLUSD/IOU) before serving โ€” the t54 "XRPL exact scheme".

Pairs with the client package Xrpl.X402. Builds on the Xrpl SDK.

๐Ÿ“– Full documentation โ€” end-to-end flow (price โ†’ pay โ†’ receipt) with XRP and RLUSD/IOU examples: x402 Agentic Payments Guide ยท API reference.

What it adds

Type Role
RequirePayment(...) endpoint filter Returns 402 + PAYMENT-REQUIRED when no payment is presented; with a valid PAYMENT-SIGNATURE it verifies + settles, sets PAYMENT-RESPONSE, and runs your handler.
IX402Facilitator Abstraction that verifies a signed payment and settles it on-ledger.
LedgerSettlingFacilitator(IXrplClient) Settles locally against your own connected node (SubmitRequestAndWait, waits for tesSUCCESS).
T54Facilitator(HttpClient, baseUrl) Delegates verify + settle to an external t54 facilitator (POST /verify, /settle). Verified live against the t54 testnet facilitator.

Usage

using Xrpl.X402.AspNetCore;
using Xrpl.X402.Wire;

IXrplClient xrpl = /* your connected IXrplClient */;
IX402Facilitator facilitator = new LedgerSettlingFacilitator(xrpl);
// or: IX402Facilitator facilitator = new T54Facilitator(new HttpClient());

app.MapGet("/paid", () => "premium content")
   .RequirePayment(facilitator, ctx => new PaymentRequirement
   {
       Scheme = "exact",
       Network = "xrpl:1",
       Asset = "XRP",
       PayTo = "rYourMerchantAddress...",
       Amount = "1000000",            // 1 XRP in drops
       MaxTimeoutSeconds = 600,
       Extra =
       {
           ["invoiceId"] = JsonSerializer.SerializeToElement("inv-123"),
           ["sourceTag"] = JsonSerializer.SerializeToElement(804681468) // t54 enforces SourceTag
       }
   });

Without a PAYMENT-SIGNATURE the endpoint returns 402 + the PAYMENT-REQUIRED challenge. With a valid signature, the facilitator verifies the destination, settles the transaction, sets PAYMENT-RESPONSE, and your handler runs. Implement IX402Facilitator for any other facilitator.

See the Xrpl.X402 README for the full wire format, client usage, security model, and t54 interop notes.

License

Apache-2.0. Part of XrplCSharp.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 103 6/24/2026