@cosmosapp/pay_sdkDéfinitionsServeur

PaymentIntent

A Stellar SEP-7 payment intent. Wraps the raw API payload with typed accessors and atomic action methods so you can operate on it directly…

A Stellar SEP-7 payment intent. Wraps the raw API payload with typed accessors and atomic action methods so you can operate on it directly: await intent.validate(txHash), await intent.cancel(), await intent.delete().

Constructor

PaymentIntent

constructor(client: Client, data: PaymentIntentData)

Parameters

  • client: Client
  • data: PaymentIntentData

Properties

kind

kind: PaymentIntentKind

status

status: PaymentIntentStatus

chain

Chain the payment settles on.

chain: PaymentChain

network

network: string

source

Payer account (null for PAY intents).

source: string | null

destination

destination: string

amount

amount: string | null

asset

Asset code, or native for the chain's coin (XLM, SOL or MON).

asset: string

assetIssuer

assetIssuer: string | null

memo

Mandatory MEMO_ID.

memo: string

msg

msg: string | null

callback

callback: string | null

xdr

Unsigned transaction envelope (base64 XDR); null for PAY intents.

xdr: string | null

uri

SEP-7 deep link (tx or pay).

uri: string

qr

QR code of the SEP-7 URI (PNG data URL).

qr: string

txHash

txHash: string | null

reference

reference: string | null

createdAt

createdAt: Date

updatedAt

updatedAt: Date

protected

protected _patch(data: PaymentIntentData): this

get

Whether this is a SEP-7 tx intent (known source, has XDR).

get isTx(): boolean

get

Whether this is a SEP-7 pay intent (no source).

get isPay(): boolean

get

Whether the payment has settled on-chain.

get isSucceeded(): boolean

get

Whether the intent is still awaiting payment.

get isPending(): boolean

get

Human-readable asset label (the chain's coin for native: XLM, SOL or MON).

get assetLabel(): string

Methods

fetch()

Re-fetch this intent from the API, returning a fresh instance.

fetch(): Promise<PaymentIntent>

Returns Promise<PaymentIntent>

edit()

Update this intent (status / txHash / reference). Mutates and returns it.

edit(options: UpdatePaymentIntentOptions): Promise<this>

Parameters

  • options: UpdatePaymentIntentOptions

Returns Promise<this>

validate()

Validate a submitted transaction against this intent. On a match the status is finalized server-side and the webhook fires.

validate(txHash: string): Promise<ValidationOutcome>

Parameters

  • txHash: string

Returns Promise<ValidationOutcome>

cancel()

Mark this intent as cancelled.

cancel(): Promise<this>

Returns Promise<this>

delete()

Delete this intent.

delete(): Promise<DeletedData>

Returns Promise<DeletedData>

toJSON()

toJSON(): PaymentIntentData

Returns PaymentIntentData

Sur cette page