Enum PaymentMethod
pub enum PaymentMethod {
Onchain {
address: Address,
amount: Option<Amount>,
label: Option<String>,
message: Option<String>,
},
Invoice {
invoice: Invoice,
},
Offer {
offer: Offer,
bip321_amount: Option<Amount>,
},
LnurlPay {
lnurl: String,
pay_request: LnurlPayRequest,
},
}Expand description
A single “payment method” – each kind here should correspond with a single linear (outbound) payment flow for a user, where there are no other alternate methods.
For example, a Unified BTC QR code contains a single BIP321 URI, which may contain multiple discrete payment methods (an onchain address, a BOLT11 invoice, a BOLT12 offer).
Compare with ClaimMethod, which is the inbound equivalent.
Variants§
Onchain
Fields
amount: Option<Amount>The amount to pay to the onchain address, if specified.
Parsed from a BIP321 URI or BOLT11 invoice containing the onchain address.
Invoice
Offer
Fields
LnurlPay
Fields
pay_request: LnurlPayRequestThe LNURL-pay request, which includes information about the amount constraints, callback, etc. associated with the LNURL.
Implementations§
§impl PaymentMethod
impl PaymentMethod
pub fn is_onchain(&self) -> bool
pub fn is_onchain(&self) -> bool
Check if the payment method is an onchain address.
pub fn is_invoice(&self) -> bool
pub fn is_invoice(&self) -> bool
Check if the payment method is a BOLT11 invoice.
pub fn is_lnurl_pay(&self) -> bool
pub fn is_lnurl_pay(&self) -> bool
Check if the payment method is an LNURL-pay endpoint.
pub fn kind(&self) -> &'static str
pub fn kind(&self) -> &'static str
Get the “kind” of the payment method as a string: “onchain”, “invoice”, “offer”, or “lnurl-pay”.
pub fn supports_network(&self, network: Network) -> bool
pub fn supports_network(&self, network: Network) -> bool
Check if the payment method is valid for the given Network.