Skip to main content
HomeLanding pagesHow to accept stablecoin payments as an agent
LANDING PAGE

How to accept stablecoin payments as an agent

7 min read·Last updated June 2, 2026

An agent accepts stablecoin payments in USDC on Base, a dollar-pegged token with 6 decimals. Funds sent to the agent's wallet arrive and fire a payment.received webhook; to charge per call, gate the agent's route with createX402Plugin from @blockchain0x/x402, which quotes an exact-usdc price and verifies payment. Stablecoins fit agent traffic because they settle sub-cent amounts a card network cannot.

What you will set up

An AI agent that accepts payment in USDC, a dollar-pegged stablecoin, on Base. Two ways: funds sent directly to the agent's wallet, and per-call charges where a caller pays before your route runs. Both settle in USDC, and both arrive without the agent holding any keys. This page leans on the stablecoin angle, why a dollar-pegged token is the right thing for an agent to accept, and how the acceptance actually works. For the receive mechanics in depth, see how-to-receive-payments-as-ai-agent; the payment API product page is the broader reference. If you are new to the model, the short version is that accepting a stablecoin payment is either watching your wallet for an arrival or putting a paywall in front of a route, and both are below.

Why stablecoins fit agent payments

Start with why this rail, because it is the reason the rest of the page is short. A stablecoin is a token pegged to a currency, and USDC is pegged to the US dollar: one USDC is one dollar. That peg is what makes it usable for accepting payment, because you can price, account, and reason in dollars while the value moves on chain.

The fit with agents is about size and frequency. An agent does not pay once a month like a subscriber; it pays per call, often hundreds of times an hour, each call worth a fraction of a cent to a few cents. A card network cannot accept a half-cent charge, because the fixed fee per authorization dwarfs it. A volatile cryptocurrency would make a five-cent price swing to seven cents before the call completed, which breaks pricing. A dollar-pegged stablecoin on a low-fee chain is the one instrument that is both stable enough to price in and cheap enough to settle at agent scale. That is why accepting stablecoins, specifically USDC on Base, is the default for an agent that gets paid, rather than an exotic choice.

Prerequisites

  • A Blockchain0x account with an agent created, so it has a wallet.
  • A sk_test_ API key for this walkthrough.
  • Node 18 or newer. The SDK targets >=18.
BASH
export B0X_API_KEY=sk_test_...        # sk_test_ -> Base Sepolia
export B0X_WEBHOOK_SECRET=...         # webhook signing secret, shown once at creation

Accept payments to the wallet

The simplest way to accept a stablecoin payment is to do nothing but watch for it. The agent's wallet has an address on Base; USDC sent there credits the agent, and a payment.received webhook fires. Verify it against the raw bytes:

TYPESCRIPT
import express from "express";
import { webhooks } from "@blockchain0x/node";

const app = express();
app.use(express.raw({ type: "application/json" }));

app.post("/webhooks/blockchain0x", (req, res) => {
  const result = webhooks.verify({ headers: req.headers, rawBody: req.body, secret: process.env.B0X_WEBHOOK_SECRET! });
  if (!result.ok) return res.status(400).json({ code: result.code });
  if (result.eventType === "payment.received") {
    // USDC arrived; credit the agent, release work, thank the payer
  }
  return res.status(200).end();
});

This covers tips, payouts, and any transfer decided elsewhere. The agent did not sign anything; the USDC simply arrived and you found out.

Charge per call in USDC

To accept payment in exchange for work, gate the agent's route so a caller pays USDC before the route runs.

TYPESCRIPT
import Fastify from "fastify";
import { createClient } from "@blockchain0x/node";
import { createX402Plugin } from "@blockchain0x/x402/server/fastify";

const sdk = createClient({ apiKey: process.env.B0X_API_KEY! });
const app = Fastify();

await app.register(createX402Plugin, {
  sdk,
  defaultNetwork: "testnet",
  pricing: { "POST /agent/answer": { amountUsdc: "0.05", payToAddress: process.env.B0X_PAYTO_ADDRESS!, paymentRequestId: "pr_answer" } },
});

app.post("/agent/answer", async (req) => runAgent(req.body)); // runs only once the USDC is verified

The adapter quotes the price in the 402 as exact-usdc, verifies the caller's X-Payment header by settling on chain, and only then runs your handler. The caller pays five cents of USDC; you account for it as five cents.

Why USDC and why Base

A word on the two specific choices, because accepting a stablecoin means accepting a particular one on a particular chain. USDC is a regulated, fully-reserved dollar stablecoin, which is what lets you treat one USDC as one dollar without hedging. Base is a low-fee Ethereum layer-2, which is what makes settling a sub-cent payment economical, the fee to move the USDC is a small fraction of the payment rather than a multiple of it. Together they give you a dollar you can move for almost nothing, which is the precise property agent payments need. The current scheme settles only exact-usdc on Base (mainnet eip155:8453, testnet eip155:84532), so you are not configuring a token or a chain, you are accepting the one combination built for this.

Stablecoins versus card and fiat

It is worth being concrete about what you give up and gain by accepting a stablecoin instead of a card, because the trade is not all upside and you should choose with open eyes.

What you gain is the ability to accept payments that a card simply cannot. Sub-cent and few-cent charges, from callers with no account, settling in seconds, for fees measured in fractions of a cent. For an agent serving machine traffic, that is the difference between a viable business and one whose payment fees exceed its revenue. You also gain global reach by default: a stablecoin payment does not care which country the caller is in, and there is no signup to localize.

What you give up is the familiarity of card rails and the consumer protections built on them, like chargebacks. A stablecoin payment is final once settled, which is good for you as the payee but means you are not the right rail for a consumer buying a refundable physical good. The honest framing: accept stablecoins when your payer is an agent or a machine making many small payments, and reach for cards when your payer is a human buying something large and refundable. For agent revenue, the stablecoin is not a compromise, it is the only rail that fits.

Confirm and test

Test acceptance on Base Sepolia first. Send the agent's wallet test USDC from a public faucet and confirm the payment.received event lands. For the charge path, call the priced route with no payment and confirm the 402, then pay it from a test wallet and confirm the handler runs. When both behave, swap to a sk_live_ key for Base mainnet, where the USDC is real.

Common pitfalls

Three traps.

Expecting a different stablecoin or chain. The scheme is exact-usdc on Base. USDC sent on another chain, or another token sent to the address, does not arrive. Confirm token and network before sharing an address.

Verifying the parsed webhook body. The HMAC is over the raw bytes. Mount the raw-body parser on the webhook route and pass the Buffer into webhooks.verify.

Pricing as if value were volatile. Because USDC is pegged, you price in plain dollars. Do not build conversion or hedging logic the peg makes unnecessary.

What to ship today

Subscribe to payment.received and send your test agent a dollar of test USDC to watch acceptance work, then gate one route to charge per call. When both behave on Base Sepolia, go live. For the receive mechanics in depth see how-to-receive-payments-as-ai-agent, and for monetization strategy see how-to-monetize-ai-agent. Pricing is on the pricing page.

FAQ

Frequently asked questions.

What stablecoin does an agent accept?

USDC on Base, a dollar-pegged stablecoin with 6 decimals. It is the only settlement token in the current scheme, exact-usdc, so you do not choose between stablecoins. One USDC is one dollar, which keeps pricing and accounting simple: you quote a route at 0.05 and the caller pays five cents of USDC.

Why a stablecoin instead of a card?

Card networks charge a fixed fee plus a percentage per authorization, so a sub-cent charge costs more in fees than the charge. Agent traffic is many small payments, which cards cannot price. A stablecoin on Base settles a half-cent payment for a fraction of a cent, with no signup or stored card, which is exactly the shape agent payments take.

Do I hold the stablecoin myself?

The agent's wallet, provisioned and managed for it, holds the USDC. You do not handle keys. Accepting a payment is funds arriving at the agent's address on Base, which you observe through the payment.received webhook and read through the API. You never sign a transaction to receive.

Is accepting stablecoins different from receiving USDC on Base?

They are the same underlying action: USDC is the stablecoin and Base is the network it settles on. This page focuses on the stablecoin angle, why a dollar-pegged token fits agent payments. For the network specifics of receiving USDC on Base, see how-to-receive-usdc-on-base.

Can I price in dollars even though it settles in USDC?

Yes, and you should. You quote amounts in USDC decimals, and because one USDC tracks one dollar, your prices read as dollar prices. The adapter converts your 0.05 to amountWeiUsdc on the wire. You think and account in dollars; the rail moves USDC.

Create your free agent wallet in 5 minutes.

First payment confirmed in under ten minutes. Free to start.