Class Bolt12Invoice


  • public class Bolt12Invoice
    extends Object
    A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent directly after scanning a refund. It includes all the information needed to pay a recipient. [`Offer`]: crate::offers::offer::Offer [`Refund`]: crate::offers::refund::Refund [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
    • Method Detail

      • offer_chains

        public Option_CVec_ThirtyTwoBytesZZ offer_chains()
        The chains that may be used when paying a requested invoice. From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. [`Offer::chains`]: crate::offers::offer::Offer::chains
      • chain

        public byte[] chain()
        The chain that must be used when paying the invoice; selected from [`offer_chains`] if the invoice originated from an offer. From [`InvoiceRequest::chain`] or [`Refund::chain`]. [`offer_chains`]: Self::offer_chains [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
      • metadata

        public Option_CVec_u8ZZ metadata()
        Opaque bytes set by the originating [`Offer`]. From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or if the [`Offer`] did not set it. [`Offer`]: crate::offers::offer::Offer [`Offer::metadata`]: crate::offers::offer::Offer::metadata
      • amount

        @Nullable
        public Amount amount()
        The minimum amount required for a successful payment of a single item. From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if the [`Offer`] did not set it. [`Offer`]: crate::offers::offer::Offer [`Offer::amount`]: crate::offers::offer::Offer::amount Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • offer_features

        @Nullable
        public OfferFeatures offer_features()
        Features pertaining to the originating [`Offer`]. From [`Offer::offer_features`]; `None` if the invoice was created in response to a [`Refund`]. [`Offer`]: crate::offers::offer::Offer [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • description

        public PrintableString description()
        A complete description of the purpose of the originating offer or refund. From [`Offer::description`] or [`Refund::description`]. [`Offer::description`]: crate::offers::offer::Offer::description
      • absolute_expiry

        public Option_u64Z absolute_expiry()
        Duration since the Unix epoch when an invoice should no longer be requested. From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
      • issuer

        @Nullable
        public PrintableString issuer()
        The issuer of the offer or refund. From [`Offer::issuer`] or [`Refund::issuer`]. [`Offer::issuer`]: crate::offers::offer::Offer::issuer Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • message_paths

        public BlindedPath[] message_paths()
        Paths to the recipient originating from publicly reachable nodes. From [`Offer::paths`] or [`Refund::paths`]. [`Offer::paths`]: crate::offers::offer::Offer::paths
      • supported_quantity

        @Nullable
        public Quantity supported_quantity()
        The quantity of items supported. From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a [`Refund`]. [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • payer_metadata

        public byte[] payer_metadata()
        An unpredictable series of bytes from the payer. From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
      • invoice_request_features

        public InvoiceRequestFeatures invoice_request_features()
        Features pertaining to requesting an invoice. From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
      • quantity

        public Option_u64Z quantity()
        The quantity of items requested or refunded for. From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
      • payer_id

        public byte[] payer_id()
        A possibly transient pubkey used to sign the invoice request or to send an invoice for a refund in case there are no [`message_paths`]. [`message_paths`]: Self::message_paths
      • payer_note

        @Nullable
        public PrintableString payer_note()
        A payer-provided note reflected back in the invoice. From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • created_at

        public long created_at()
        Duration since the Unix epoch when the invoice was created.
      • relative_expiry

        public long relative_expiry()
        Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore should no longer be paid.
      • is_expired

        public boolean is_expired()
        Whether the invoice has expired.
      • payment_hash

        public byte[] payment_hash()
        SHA256 hash of the payment preimage that will be given in return for paying the invoice.
      • amount_msats

        public long amount_msats()
        The minimum amount required for a successful payment of the invoice.
      • invoice_features

        public Bolt12InvoiceFeatures invoice_features()
        Features pertaining to paying an invoice.
      • signing_pubkey

        public byte[] signing_pubkey()
        The public key corresponding to the key used to sign the invoice.
      • signature

        public byte[] signature()
        Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`].
      • signable_hash

        public byte[] signable_hash()
        Hash that was used for signing the invoice.
      • verify

        public Result_ThirtyTwoBytesNoneZ verify​(ExpandedKey key)
        Verifies that the invoice was for a request or refund created using the given key. Returns the associated [`PaymentId`] to use when sending the payment.
      • write

        public byte[] write()
        Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read