← Back to A2A Gateway

The five-minute invoice window is where agent payments break

We ran an x402 gateway on Base mainnet for seven days. The numbers are small and the lesson is not.

Current availability policy: the gateway no longer has a hardcoded business-hours or weekend closure. Maintenance or downstream outages return HTTP 503; admission contention returns HTTP 429 with Retry-After. This is not an uptime guarantee. The schedule described below is historical context from the period covered by this article.

1. A 402 is a quote, not a failure

In x402, the first call to a paid endpoint returns 402 Payment Required with an invoice. Nothing is wrong. The client is supposed to pay, then retry with proof. Every piece of tooling that treats 4xx as "broken" will therefore treat the correct first step as an error.

That distinction matters more for agents than for humans. A human sees a price. An agent sees a status code, and many agent loops are built to retry non-2xx responses — sometimes forever.

2. What seven days actually looked like

Over 19,200 logged requests in a week:

SignalValue
Invoices issued508
Expired unpaid456
Settled32
Distinct paying wallets1
Invoice TTL300 s

Two of those lines deserve attention. First, the expiry-to-settlement ratio. Second, the wallet count: every settled invoice came from one address — our own operational wallet. In other words, the gateway had zero external paying customers, while 456 invoices were created for someone and never paid.

The most instructive trace was also the most embarrassing: 17 retries of the same endpoint over 2.5 hours, from one address that had already fetched our manifest and llms.txt dozens of times, never completing the payment leg. We later matched that address to our own proxy egress — it was our testing traffic. The retry pattern is still real; the attribution was wrong. Before blaming an agent, verify the address isn't yours.

Retries without a completed payment are not demand. They are the shape of a missing instruction.

3. Three consequences for autonomous clients

Retry amplification. A 300-second window plus a client that retries on failure produces N invoices for one intent. On the seller side the invoice table grows; on the buyer side the chance of paying against a stale invoice grows with it.

Duplicate payment risk. If an agent pays invoice A, its retry mints invoice B, and the settlement path keys on whatever invoice the client last saw, you now need idempotency at the settlement layer — not just at the HTTP layer.

Metrics you cannot trust. "402 count" is a mixture of probes, indexers, edge traffic and real clients. Before filtering, 320 of our 427 402s were Cloudflare-internal requests and Docker health checks — roughly a 4× overstatement of apparent demand.

4. What we changed

Historical behavior during the period covered here: paid calls outside the then-configured operating window returned 503 without an invoice. That schedule is no longer a hardcoded closure rule.

Invoice only if the call can execute. Invoices are created at the admission boundary, not before it, so a rejected call never produces one.

Failure terms at publication time. The REST and MCP settlement wording in this historical write-up reflects the policy then in force; check the current service response and payment terms before paying. Availability may be interrupted by maintenance, downstream outages, or capacity.

Discovery paths that agents actually probe. /.well-known/x402, /agents.json and /api/v1/agents.json now return real records instead of 404. One visitor we logged walked through four 404s in thirteen seconds before leaving.

5. A five-point checklist for x402 sellers

  1. Decide what a 402 means in your system, then make every surface say the same thing: response body, docs, llms.txt.
  2. Put a runnable sequence in the 402 itself — address, amount, invoice id, signature field, and the exact retry call.
  3. Make expiry a terminal state. If invoices can sit in PENDING forever, every downstream count is fiction.
  4. Use an idempotency key on settlement, not on the HTTP call.
  5. Filter probes and edge traffic out of your funnel before drawing conclusions from it.

A minimal paid call, start to finish

# 1. Ask for a quote (no payment yet)
curl -s -X POST https://a2a.musefish.trade/api/v1/token-report \
  -H 'Content-Type: application/json' \
  -d '{"token_address":"0x4200000000000000000000000000000000000006"}'

That returns 402 with an invoiceId, payTo, amount, challengeToSign and a one-line instruction. Pay the amount on Base, sign the challenge, then retry the same call with tx_hash, invoice_id, signature and payer_address. The response body carries settlementTerms describing what happens if anything fails.

All figures come from this gateway's own invoice and traffic tables for the seven days ending 2026-11-10. No third-party benchmark is cited.