Direct answer

x402 Tutorial: Agent Payments Step by Step

This is the working walkthrough: a client asks for a paid resource, the server answers 402 Payment Required with the price, the client pays in USDC on Base and retries with proof of payment, the server delivers, and the job ends with a receipt that carries the payment reference. Each step below is small, and you test the whole loop with a small amount before trusting it with real work. For the concept explainer first, read what is x402.

Zambo speaks x402 today, and its Day Pass is the small amount to test with: $0.99 for 24 hours. See a payment-backed job's record shape in this worked example receipt.

Updated October 20, 2026.

The concepts, in one pass

Step 1: the server answers 402

Your walkthrough starts with a plain request to a paid endpoint with no payment attached. Expect a refusal that is also a price quote:

HTTP/1.1 402 Payment Required

{
  "amount": "990000",
  "asset": "USDC",
  "network": "base",
  "payTo": "<seller address>"
}

Read the fields before paying anything: the amount in the asset's smallest unit, the asset, the network, and the destination. A client that skips this read is a client that can be overcharged by any endpoint that lies, so log the quote as step one of the job record.

Step 2: the client pays and retries

The client pays the quoted amount in USDC on Base to the quoted address, then repeats the original request with the payment reference attached as proof. The server checks the payment against the quote: right asset, right network, right amount, right destination, not already spent on an earlier retry. On a match, the server does the work and returns the result like any normal response. On a mismatch, it answers 402 again, and the client stops rather than paying twice: a second payment is a bug, not a retry strategy.

Step 3: the receipt with the payment reference

Payment alone proves money moved; it does not prove what it bought. That is why the flow ends with a receipt: the record of the work, saved when the work ran, carrying the payment reference alongside the result. With Zambo, the receipt is a public page in the AER-1 format, checkable by anyone at zambo.dev/verify. The payer can show what the payment bought, the seller can show what was delivered for it, and neither side is working from chat logs. The worked example at zambo.dev/run/28c79cde shows the record shape.

Step 4: test with small amounts

  1. Use the smallest paid call you can find. A $0.99 Day Pass at zambo.dev/day-pass exercises the full loop for less than a dollar.
  2. Walk the loop by hand once. Request, read the 402 quote, pay, retry, and open the receipt. Knowing each step by sight makes automated failures easy to spot later.
  3. Set a spend cap before automating. An agent that can pay can also loop; cap the per-job and per-day amounts in your client before unattended runs.
  4. Keep the receipts. File the receipt link with the job, so a later question about the payment starts from the record, not from a wallet history search.

For $0.99, a Day Pass covers 24 hours of full use. Ongoing use is the Zambo Pass at $29 a month or $290 a year, and $19 a month for $ZAMBO holders. Humans pay by PayPal or card through PayPal; agents pay with USDC on Base via x402.

Honest limits

This tutorial describes the x402 flow as Zambo implements it; other servers may quote different assets or networks, so read each 402 response on its own terms instead of assuming Base and USDC everywhere. A payment reference proves a payment was made and referenced by the record. The receipt proves the saved result was not changed after the fact; neither proves the purchased work was correct, so check outputs the way you would check any paid work.

Frequently asked questions

What is x402 in simple terms?

x402 is a payment flow built on the HTTP 402 Payment Required status. A client requests a paid resource, the server replies 402 with the price, asset, network, and destination, the client pays and retries with proof of payment, and the server delivers. No separate billing account is needed because the price travels with the refusal.

What does an agent need to pay with x402?

An agent needs a wallet holding the quoted asset, on the quoted network, plus a client that can read a 402 response, make the payment, and retry the request with the payment reference. With Zambo the asset is USDC and the network is Base. Humans pay the same prices by PayPal or card through PayPal.

How much should I spend testing x402?

Start with the smallest real payment available so a mistake costs almost nothing. The Zambo Day Pass is $0.99 one time for 24 hours, which is enough to run the full loop: 402 quote, payment, retry, delivery, and a receipt you can check at zambo.dev/verify.

Where does the receipt fit in an x402 payment?

The receipt is the record of the work the payment bought, saved when the work ran and carrying the payment reference. A wallet history shows money moved; the receipt shows what it moved for, and anyone can check the receipt to confirm the saved result was not changed after the fact.

What stops an agent from paying twice for one call?

Discipline in the client: pay only against a fresh 402 quote, attach the payment reference to the retry, and treat a second 402 for the same request as a stop signal rather than an invitation to pay again. Setting a per-job spend cap in the client is the backstop that keeps a loop from becoming a loss.

Related