Table of Contents

Class LNURLPayRequest

Namespace
LNURL
Assembly
LNURL.Core.dll

Represents an LNURL-pay request as defined in LUD-06. Contains the service parameters for initiating a Lightning payment, including sendable amount range, metadata, and optional payer data fields (LUD-18).

public class LNURLPayRequest
Inheritance
LNURLPayRequest
Inherited Members

Properties

AllowsNostr

Gets or sets whether this service supports Nostr zap receipts (NIP-57).

[JsonProperty("allowsNostr", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("allowsNostr")]
public bool? AllowsNostr { get; set; }

Property Value

bool?

Callback

Gets or sets the callback URL to which the wallet sends the payment amount to receive a BOLT11 invoice.

[JsonProperty("callback")]
[JsonConverter(typeof(UriJsonConverter))]
[JsonPropertyName("callback")]
public Uri Callback { get; set; }

Property Value

Uri

CommentAllowed

Gets or sets the maximum number of characters allowed in a payment comment (LUD-12).

[JsonProperty("commentAllowed", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("commentAllowed")]
public int? CommentAllowed { get; set; }

Property Value

int?

MaxSendable

Gets or sets the maximum amount the service accepts, in millisatoshis.

[JsonProperty("maxSendable")]
[JsonConverter(typeof(LightMoneyJsonConverter))]
[JsonPropertyName("maxSendable")]
public LightMoney MaxSendable { get; set; }

Property Value

LightMoney

Metadata

Gets or sets the raw JSON-encoded metadata string.

[JsonProperty("metadata")]
[JsonPropertyName("metadata")]
public string Metadata { get; set; }

Property Value

string

MinSendable

Gets or sets the minimum amount the service accepts, in millisatoshis.

[JsonProperty("minSendable")]
[JsonConverter(typeof(LightMoneyJsonConverter))]
[JsonPropertyName("minSendable")]
public LightMoney MinSendable { get; set; }

Property Value

LightMoney

NostrPubkey

Gets or sets the Nostr public key of the service, used for zap receipts (NIP-57).

[JsonProperty("nostrPubkey", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("nostrPubkey")]
public string? NostrPubkey { get; set; }

Property Value

string

ParsedMetadata

Gets the parsed metadata as a list of key-value pairs where the key is the MIME type and the value is the content.

[JsonIgnore]
[JsonIgnore]
public List<KeyValuePair<string, string>> ParsedMetadata { get; }

Property Value

List<KeyValuePair<string, string>>

PayerData

Gets or sets the payer data fields that the service accepts or requires (LUD-18).

[JsonProperty("payerData", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("payerData")]
public LNURLPayRequest.LUD18PayerData PayerData { get; set; }

Property Value

LNURLPayRequest.LUD18PayerData

Tag

Gets or sets the LNURL tag. For pay requests this is always "payRequest".

[JsonProperty("tag")]
[JsonPropertyName("tag")]
public string Tag { get; set; }

Property Value

string

Gets or sets an optional LNURL-withdraw link associated with this pay request (LUD-19).

[JsonProperty("withdrawLink", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(UriJsonConverter))]
[JsonPropertyName("withdrawLink")]
public Uri WithdrawLink { get; set; }

Property Value

Uri

Methods

SendRequest(LightMoney, Network, HttpClient, string, LUD18PayerDataResponse, CancellationToken)

Sends the second step of the LNURL-pay flow (LUD-06) by calling the service callback with the chosen amount, optional comment (LUD-12), and optional payer data (LUD-18).

public Task<LNURLPayRequest.LNURLPayRequestCallbackResponse> SendRequest(LightMoney amount, Network network, HttpClient httpClient, string comment = null, LNURLPayRequest.LUD18PayerDataResponse payerData = null, CancellationToken cancellationToken = default)

Parameters

amount LightMoney
network Network
httpClient HttpClient
comment string
payerData LNURLPayRequest.LUD18PayerDataResponse
cancellationToken CancellationToken

Returns

Task<LNURLPayRequest.LNURLPayRequestCallbackResponse>

VerifyPayerData(LUD18PayerData, LUD18PayerDataResponse)

Verifies that a payer data response satisfies the given payer data field requirements (LUD-18).

public static bool VerifyPayerData(LNURLPayRequest.LUD18PayerData payerFields, LNURLPayRequest.LUD18PayerDataResponse payerData)

Parameters

payerFields LNURLPayRequest.LUD18PayerData
payerData LNURLPayRequest.LUD18PayerDataResponse

Returns

bool

VerifyPayerData(LUD18PayerDataResponse)

Verifies that the given payer data response satisfies the requirements defined in this pay request's PayerData fields (LUD-18).

public bool VerifyPayerData(LNURLPayRequest.LUD18PayerDataResponse response)

Parameters

response LNURLPayRequest.LUD18PayerDataResponse

Returns

bool