Class X402PaymentExtensions
Extensions to protect ASP.NET Core minimal-API endpoints with x402 payment.
Inheritance
object
X402PaymentExtensions
Namespace: Xrpl.X402.AspNetCore
Assembly: Xrpl.X402.AspNetCore.dll
Syntax
public static class X402PaymentExtensions
Methods
| Edit this page View SourceRequirePayment<TBuilder>(TBuilder, IX402Facilitator, Func<HttpContext, PaymentRequirement>)
Require an x402 payment for this endpoint. Without a valid PAYMENT-SIGNATURE the endpoint returns 402 + PAYMENT-REQUIRED challenge; with a valid, settled signature it sets PAYMENT-RESPONSE and executes the handler.
Declaration
public static TBuilder RequirePayment<TBuilder>(this TBuilder builder, IX402Facilitator facilitator, Func<HttpContext, PaymentRequirement> requirementFactory) where TBuilder : IEndpointConventionBuilder
Parameters
| Type | Name | Description |
|---|---|---|
| TBuilder | builder | The endpoint convention builder to protect. |
| IX402Facilitator | facilitator | Facilitator that verifies and settles the payment on-ledger. |
| Func<HttpContext, PaymentRequirement> | requirementFactory | Factory that produces the PaymentRequirement for a given request, allowing per-request price/payTo/invoiceId customisation. |
Returns
| Type | Description |
|---|---|
| TBuilder | The same |
Type Parameters
| Name | Description |
|---|---|
| TBuilder | Any Microsoft.AspNetCore.Builder.IEndpointConventionBuilder. |