Skip to content

List payment options

Lists the payment options available for a transaction for the user's wallet based on their balance across chains and tokens and the required transaction amount.

Import

import { listPaymentOptions } from "@paywithglide/glide-js";

Usage

Parameters

chainId*
number

The EIP-155 chain ID of the chain where the transaction will be executed.

account
nullable string

The wallet address that will be used to pay for the transaction. If set, only the payment options for which the user has a balance will be returned.

address*
string

The contract's address, or the recipient's address if the transaction is not a contract call.

abi
nullable object[]

The contract's ABI.

functionName
nullable string

The name of the function to be called on the contract.

args
nullable unknown[]

Arguments to be passed when calling the function.

value
nullable bigint

Value in the smallest unit (ex. wei) to be sent with the transaction.

approval
nullable object

The approval object, required if the transaction requires spending of an ERC-20 token.

token
nullable Hex

The token's contract address that needs to be approved for spending.

amount
nullable bigint

The amount to approve, in the token's smallest unit.

paymentCurrencies
nullable string[]

List of payment currencies in the CAIP-19 format that should be considered for the transaction. Cannot be used with paymentChainIds.

paymentChainIds
nullable number[]

List of EIP-155 chain IDs that should be considered for the transaction. Cannot be used with paymentCurrencies.

commissionUSD
nullable number

The commission amount in USD that will be added on top of the transaction cost and will be paid out to the developer.

Return Type

chainId*
number

The EIP-155 chain ID of the chain where the transaction will be executed.

chainName*
string

The name of the chain where the transaction will be executed.

chainLogoUrl*
string

The URL of the chain's logo.

paymentAmount*
string

The estimated payment amount required for the transaction in the payment currency.

paymentCurrency*
CAIP19

The currency in which the user pays in CAIP-19 format.

currencyName*
string

The name of the payment currency.

currencySymbol*
string

The symbol of the payment currency.

currencyLogoUrl*
string

The URL of the payment currency's logo.

balance
nullable string

The user's current balance of the payment currency. Only set if the account parameter is provided.

balanceUSD
nullable string

The user's current balance of the payment currency in USD. Only set if the account parameter is provided.

transactionAmount*
string

The estimated amount required to complete the transaction in the transaction currency.

transactionCurrency*
CAIP19

The currency required by the transaction to be executed, in CAIP-19 format.

transactionCurrencyName*
string

The name of the transaction currency. Ex. "Ethereum".

transactionCurrencySymbol*
string

The symbol of the transaction currency. Ex. "ETH".

transactionCurrencyLogoUrl*
string

The URL of the transaction currency's logo.