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

index.ts
import { listPaymentOptions, currencies, chains } from "@paywithglide/glide-js";
import { config } from "./config";
 
const paymentOptions = await listPaymentOptions(config, {
  chainId: chains.base.id,
  account: "0xc6FfEB1298Eb33Da430d14e5Eb789256ec344625",
 
  abi: fabricAbi,
  address: "0x1169c6769c4F4B3cA1944AF0F26B36582fd5279d",
  functionName: "mintFor",
  args: ["0xc6FfEB1298Eb33Da430d14e5Eb789256ec344625", 999999907200n],
  value: 999999907200n,
});

Parameters

chainId*
number

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

account*
string

The wallet address that will be used to pay for the transaction.

abi*
object[]

The contract's ABI.

address*
string

The contract's address.

functionName*
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.

paymentCurrencies
nullable string[]

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

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

paymentAmount*
string

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

paymentCurrency*
CAIP19 | Currency

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*
string

The user's current balance of the payment currency.

balanceUSD*
string

The user's current balance of the payment currency in USD.