Funding a wallet means transferring crypto to a wallet address. Having crypto in your wallet is key to many use cases such as using the wallet to make payments, transact onchain, or deploy smart contracts. There are several ways to fund an API Wallet:

  1. Wallet Funding API (Alpha): With CDP SDK, you can fund your wallet from fiat currency in a bank account with a single API call. This method is currently limited to US-based individuals using US debit card (without 3DS verification) payment methods configured in a Coinbase account. We will add support for businesses, and for additional payment methods soon. This method currently supports funding wallets with USDC and ETH, with additional assets coming soon.
  2. Send crypto from an external wallet: If you already have crypto in another wallet, you can fund your API Wallet by transferring crypto from the other wallet to your API Wallet.
  3. Use Coinbase Product APIs: You can use Coinbase Product APIs (Retail / Exchange) to buy and transfer crypto to your API Wallet address.

Start by creating a Coinbase account if you don’t already have one, and add payment method(s).

Wallet Funding API (Alpha)

For this method, you need a Coinbase account with a US debit card (non-3DS) payment method configured. CDP SDK provides methods to get a quote if desired, and call the Wallet Funding API to buy crypto and transfer it to the indicated API Wallet. If you have multiple debit cards set up, this method will use the first non-3DS, active, verified card you added. The sections below walk through how to use these SDK methods.

Supported Assets

You can fund your wallet with assets that are supported in the Coinbase App for the applicable network. Not all assets are available to fund on every network; availability in the Wallet Funding API will mirror an asset’s availability in the Coinbase App.

For all of our supported EVM networks eth and usdc will be supported, and you can Trade those assets for your desired asset.

Limits

Wallet funding limits are the same as your Coinbase account limits.

Get a quote

You may want to obtain estimates for the network fee and Coinbase fee (if applicable - save on fees with Coinbase One) associated with your wallet funding operation, before executing it. You can do this by calling the quoteFund method, as shown below. The quoteFund method returns a QuoteID and estimated network and Coinbase fees, as applicable.

// Obtain a quote for funding a wallet with 100 USDC
const myQuote = await wallet.quoteFund({ amount: 100, assetId: 'usdc' });

// Parameters of the quote you can inspect to see if you want to execute it.
// Crypto Amount requested
console.log(myQuote.getAmount().getAmount());
// Crypto Amount converted to Fiat + Buy Fee
console.log(myQuote.getFiatAmount());
// Buy fee
console.log(myQuote.getBuyFee().amount);
// Transfer fee
console.log(myQuote.getTransferFee().getAmount());

Fund your API Wallet

The wallet.fund() method will buy a specified amount of a given crypto asset using your Coinbase account, and transfer it to your API Wallet using the network you configured when creating your wallet. Fees, if applicable, will be charged in addition to the target amount.

If you have already generated a quote, you can simply execute it to initiate wallet funding:

// Execute the previously quoted wallet funding operation
let fundOperation = await myQuote.execute();

// Wait for the funding operation to settle
await fundOperation.wait();

The operation shown above will execute the previously-quoted funding operation - in this example, buying 100 USDC, then transferring the 100 USDC to your API Wallet using the network associated with your API Wallet.

If you want to directly execute a wallet funding operation without first getting a quote, you may directly call the wallet.fund method specifying the amount and crypto asset.

// Initiate the funding operation
const fundOperation = await wallet.fund(100, 'usdc');

// Wait for the funding operation to settle
await fundOperation.wait();

Receive crypto from an external wallet

You can fund your API Wallet by receiving crypto from an external wallet. To do this, get the deposit address of the API Wallet by calling the getDefaultAddress API.

// Get the default_address in the wallet, which will be the deposit address.
let address = await wallet.getDefaultAddress();
console.log(`Deposit Address: ${address}`);

Once you have the deposit address, you can send crypto to the deposit address from an external wallet.

Use Coinbase products to move funds to your API Wallets

Another way to move funds to your API Wallet is to use Coinbase products.

Sign up on Coinbase

The first step in using Coinbase products to move funds to your API Wallet is to create a Coinbase account.

If you are an individual, you can use a personal Coinbase App account.

If you are a business, you can use Coinbase Exchange. The onboarding process will involve answering questions about yourself and your business. If you need assistance in business onboarding, reach out to us in the #wallet-api channel of the CDP Discord.

Send funds from Coinbase Retail / Exchange

Once you have onboarded to Retail / Exchange, you can buy crypto with payment methods of your choice on these platforms.

  • Supported payment methods on Coinbase Exchange can be found here.
  • Supported payment methods on Coinbase Retail can be found here.

You can then move the funds to your wallet with the code snippets below.

Move funds from Retail via Coinbase App APIs

Move funds from Exchange via Exchange API

Withdrawing crypto to fiat

You may wish to convert crypto in your API Wallet to fiat in a bank account. You can do this using the following steps:

  1. Get your Coinbase App deposit address for the same network as the API Wallet from which you want to withdraw
  2. Use the Transfer API to move funds from your API Wallet to your Coinbase account
  3. Once the crypto is in your Coinbase account, you can sell crypto for cash
  4. Lastly, follow the steps in cash out your funds for fiat in your selected payment method

If you are interested in an API-based crypto-to-fiat withdrawal feature, please reach out to us in the #wallet-api channel of the CDP Discord.