Skip to main content

Payment

Struct Payment 

Source
pub struct Payment {
Show 27 fields pub index: PaymentCreatedIndex, pub rail: PaymentRail, pub kind: PaymentKind, pub direction: PaymentDirection, pub hash: Option<PaymentHash>, pub preimage: Option<PaymentPreimage>, pub offer_id: Option<OfferId>, pub txid: Option<Txid>, pub amount: Option<Amount>, pub fees: Amount, pub partner_pk: Option<UserPk>, pub partner_prop_fee: Option<Ppm>, pub partner_base_fee: Option<Amount>, pub status: PaymentStatus, pub status_msg: String, pub address: Option<Arc<Address<NetworkUnchecked>>>, pub invoice: Option<Arc<Invoice>>, pub tx: Option<Arc<Transaction>>, pub client_pk: Option<PublicKey>, pub payer_name: Option<String>, pub message: Option<String>, pub personal_note: Option<String>, pub priority: Option<ConfirmationPriority>, pub expires_at: Option<TimestampMs>, pub finalized_at: Option<TimestampMs>, pub created_at: TimestampMs, pub updated_at: TimestampMs,
}
Expand description

Information about a payment.

Fields§

§index: PaymentCreatedIndex

The payment’s index: its id prefixed with created_at.

Prefer to use this as the primary identifier for the payment, as you can degenerate it into a String while retaining timestamp-based lexicographic sorting for free. e.g. use BTreeMap<String, Payment> or BTreeMap<PaymentCreatedIndex, Payment>.

See PaymentCreatedIndex for more details.

§rail: PaymentRail

The technical ‘rail’ used to fulfill a payment: ‘onchain’, ‘invoice’, ‘offer’, ‘spontaneous’, ‘waived_fee’, etc.

§kind: PaymentKind

Application-level payment kind.

§direction: PaymentDirection

The payment direction: "inbound", "outbound", or "info".

§hash: Option<PaymentHash>

(Lightning payments only) The payment hash.

§preimage: Option<PaymentPreimage>

(Lightning payments only) The payment preimage. Serves as proof-of-payment for outbound payments. For inbound payments, only populated if the payment succeeded.

§offer_id: Option<OfferId>

(Offer payments only) The id of the BOLT12 offer used in this payment.

§txid: Option<Txid>

(Onchain payments only) The hex-encoded Bitcoin txid.

§amount: Option<Amount>

The amount of this payment.

  • If this is a completed inbound invoice payment, this is the amount we received.
  • If this is a pending or failed inbound inbound invoice payment, this is the amount encoded in our invoice, which may be null.
  • For all other payment types, an amount is always included.
§fees: Amount

The fees for this payment.

  • If partner_pk is set, this means that the partner, not Lexe, determined the fee for this payment.
§partner_pk: Option<UserPk>

The partner’s user_pk, if the fees for this payment were set by a Lexe partner, instead of using Lexe’s default fees.

§partner_prop_fee: Option<Ppm>

The proportional fee set by the partner.

§partner_base_fee: Option<Amount>

The base fee set by the partner.

§status: PaymentStatus

The status of this payment: [“pending”, “completed”, “failed”].

§status_msg: String

The payment status as a human-readable message. These strings are customized per payment type, e.g. “invoice generated”, “timed out”

§address: Option<Arc<Address<NetworkUnchecked>>>

(Onchain send only) The address that we’re sending to.

§invoice: Option<Arc<Invoice>>

(Invoice payments only) The BOLT 11 invoice used in this payment.

§tx: Option<Arc<Transaction>>

The on-chain transaction, if there is one. Always Some for on-chain sends and receives.

§client_pk: Option<PublicKey>

The public key of the Lexe SDK client which created this payment. (Inbound offer payments aren’t tracked yet.) None means either root seed authentication was used, or the client was never recorded.

§payer_name: Option<String>

(Offer payments only) The payer’s self-reported human-readable name.

§message: Option<String>

(Offer payments, LNURL-pay invoices) A payer-provided note for this payment.

§personal_note: Option<String>

An optional personal note which a user can attach to any payment. A personal note can always be added or modified when a payment already exists, but this may not always be possible at creation time.

§priority: Option<ConfirmationPriority>

(Onchain send only) The confirmation priority used for this payment.

§expires_at: Option<TimestampMs>

The invoice or offer expiry time. None otherwise, or if the timestamp overflows.

§finalized_at: Option<TimestampMs>

If this payment is finalized, meaning it is “completed” or “failed”, this is the time it was finalized, in milliseconds since the UNIX epoch.

§created_at: TimestampMs

When this payment was created.

§updated_at: TimestampMs

When this payment was last updated.

Implementations§

Source§

impl Payment

Source

pub fn updated_index(&self) -> PaymentUpdatedIndex

This payment’s updated_at index.

Trait Implementations§

Source§

impl Clone for Payment

Source§

fn clone(&self) -> Payment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de> Deserialize<'de> for Payment

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<BasicPaymentV2> for Payment

Source§

fn from(p: BasicPaymentV2) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Payment

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<F, T, U> Apply<F, U> for T
where F: FnOnce(T) -> U,

§

fn apply(self, f: F) -> U

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,