Skip to content

Onramp link (fund a wallet with a card)

$0.001 per callUSDC via x402POST /api/onramp-link

Generate a single-use hosted onramp URL that lets a human fund any wallet with a card or Apple Pay - the fastest way to put real USDC into an agent's wallet. Send POST /api/onramp-link with the required field address and pay $0.001 per call over x402 or MPP (there is no free tier). It returns a JSON object with onrampUrl, singleUse and note.

Returns the ready-to-open URL, and a fee-inclusive quote when the onramp provides one. Networks: base, ethereum, polygon, arbitrum, optimism, solana.

Category: Wallet operationsTags: wallet onboarding x402 agent-wallet onramp fiat usdc fund-wallet

Try in playground →

Parameters

NameTypeRequiredDescription
addressstringyesDestination wallet address (EVM 0x… or Solana base58, matching the network) Also accepted as addr, wallet, account.
networkstringnobase (default) | ethereum | polygon | arbitrum | optimism | solana
assetstringnoTicker to purchase (default USDC)
amountstringnoCrypto amount the wallet should receive (default 10)
countrystringnoBuyer's ISO 3166-1 country code (default US)
subdivisionstringnoUS state code (e.g. NY) - required for US buyers by some payment methods
redirectUrlstringnoOptional URL to send the buyer to after checkout

Example request

curl -i -X POST https://agent402.tools/api/onramp-link \
  -H "Content-Type: application/json" \
  -d '{"address":"0xaBF4FAbd7c416fB67202E5f9002389Fc75e2a9D0","network":"base","amount":"10"}'

Without payment this returns HTTP 402 Payment Required with the exact price for onramp-link; any x402 v2 or MPP client pays it and retries.

Example response

{
  "onrampUrl": "https://pay.coinbase.com/…single-use…",
  "singleUse": true,
  "note": "Open the URL in a browser to complete the purchase - it is single-use and expires after first visit."
}
FieldTypeAlways presentIn the example
onrampUrlstringyeshttps://pay.coinbase.com/…single-use…
singleUsebooleanyestrue
notestringyesOpen the URL in a browser to complete the purchase - it is single-use and exp...

From an MCP client

catalog.call {
  "slug": "onramp-link",
  "params": {
    "address": "0xaBF4FAbd7c416fB67202E5f9002389Fc75e2a9D0",
    "network": "base",
    "amount": "10"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for onramp-link; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.13.32.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.001" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/onramp-link", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "address": "0xaBF4FAbd7c416fB67202E5f9002389Fc75e2a9D0",
    "network": "base",
    "amount": "10"
  }),
});

Part of these workflows

Onramp link (fund a wallet with a card) is one step in this skill pack, each sold as a single call:

Related tools

Onchain SQL (query Base with SQL)

$0.03POST /api/onchain-sql

Run read-only SQL against indexed, DECODED blockchain data - base.events (decoded logs with parameters).

Onchain SQL schema

$0.002GET /api/onchain-sql-schema

The table + column schema for the onchain-sql tool - every queryable table (base.events, base.transactions, base.blocks.

Testnet faucet (try x402 free)

$0.001POST /api/testnet-fund

Fund any address with testnet money from a testnet faucet - USDC (1) or ETH (0.0001) on Base Sepolia, USDC (1) or SOL.

Wallet token balances (indexed)

$0.002GET /api/wallet-balances

All token balances for any address in one call, from an indexed chain-data API - ERC-20 + native on EVM, SPL on Solana.

My usage (wallet-keyed purchase history)

$0.005POST /api/my-usage

Your own purchase history, keyed to the wallet that pays for the call - no wallet parameter, no signup: the x402 payment.

x402 seller dossier

$0.05POST /api/seller-dossier

Everything Agent402 knows about one x402 seller origin, in one read: identity and crawl history, the catalog.