Skip to content

Pay with any ERC-20 token

In this guide, we'll enable our users to mint an ETH-only NFT using USDC. We'll use a sample NFT contract available on Fabric.

Setup

Before you start, make sure you setup the Glide client using the Installation guide.

Submit transaction via Glide

Payment currency

In the example above, we're restricting the user to pay with USDC on Base. If you want to allow the user to pay with any other token, you can use its CAIP-19 address.

Currencies

To get the CAIP-19 address for any of the supported tokens, you can use the currencies object:

import { currencies } from "@paywithglide/glide-js";
 
const baseUSDCAddress = currencies.usdc.on(chains.base);
// returns "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"

List payment options

Instead of hardcoding a payment currency, you can also list all the supported payment options for the user to choose from. Use the listPaymentOptions action to get the list of supported payment options specific to the user's wallet and the transaction.