Coronium Mobile Proxies

HTTP 402 Payment Required: how AI agents pay for APIs

By Coronium Technical Team - - 8 minute read

HTTP has a status code for โ€œpay firstโ€, and for most of its life nobody agreed on how to use it. Two agent payment protocols now do: Stripe and Tempoโ€™s Machine Payments Protocol (MPP) and x402. Both answer an unpaid request with 402 and a price, and both let the client pay and retry the same request.

Real examples below come from Coronium, which sells mobile proxy lines through both protocols. Part of the agentic payments for mobile proxies guide.

What the HTTP standard says about 402

โ€œThe 402 (Payment Required) status code is reserved for future use.โ€[1]

That one sentence is the whole definition in RFC 9110, the current HTTP semantics standard (June 2022). It reserves the number and leaves the mechanism open. Any meaning a 402 has today comes from the protocol the server speaks, so a client has to read the headers to know what kind of 402 it got.

Why 402 came back

Paying for an API used to mean creating an account, choosing a subscription and entering a card, which Stripe notes are flows that need human input and block agents from finishing tasks on their own.[5] A 402 with a machine-readable price lets the client pay inside the request it was already making: request, get a price, pay, retry, get the result.

Stripeโ€™s machine payments accept MPP (cards through shared payment tokens, and stablecoins) and x402 stablecoin payments on Base.[5] The two protocols carry the 402 differently.

402 in the Machine Payments Protocol

MPP uses HTTPโ€™s authentication framework. The 402 carries a Payment challenge in WWW-Authenticate; the client answers with a credential in Authorization: Payment, or in Payment-Authorization when the challenge names it; success comes back with Payment-Receipt.[3]

http
HTTP/1.1 402 Payment Required
WWW-Authenticate: Payment id="abc123",
    realm="mpp.dev",
    method="tempo",
    intent="charge",
    request="eyJ..."
The example challenge from mpp.devโ€™s HTTP 402 page.

mpp.dev says to answer 401 first when the client fails ordinary authentication and to send the 402 only after it passes, so payment terms are not shown to unauthenticated clients. With mppx, requiresAuth: true advertises Payment-Authorization for the payment and keeps the applicationโ€™s own credential in Authorization.[2]

Coronium works that way: POST /payment/mpp needs the buyerโ€™s API key in Authorization: Bearer, answers a valid request with a 402 challenge for realm api.coronium.io, method stripe and intent charge, valid 5 minutes with the amount in cents, and takes the payment in Payment-Authorization.[7][9] Step by step: buying a mobile proxy with Stripe MPP.

Retryable payment failures also answer 402, with a fresh challenge and a Problem Details body, so a second 402 after an attempt is not always a new price. mpp.devโ€™s advice: reconcile an uncertain payment before paying the fresh challenge.[2]

402 in x402

x402 carries the price in a PAYMENT-REQUIRED header: base64-encoded JSON listing what the server accepts. The client sends the signed payment in PAYMENT-SIGNATURE, and the server returns the settlement in PAYMENT-RESPONSE.[4]

http
HTTP/2 402
payment-required: <base64 JSON: x402Version 2, accepts[0] = scheme exact,
  network eip155:8453, amount in USDC base units, asset, payTo, maxTimeoutSeconds 120>
Coroniumโ€™s answer to an unpaid POST https://api.coronium.io/api/v3/x402/buy, from the x402 buyer guide.

Each entry in accepts names a scheme, a network, an amount in the tokenโ€™s base units, the asset, where to pay and a time limit. At Coronium the client signs an EIP-3009 authorization for exactly that amount and sends the same request again; no account is needed, and the paying wallet becomes the account.[6] Step by step: buying a mobile proxy with x402 and USDC.

402 vs 401, 403 and 409

An agent that buys has to tell these apart, because only one of them is a price:[2][6][9]

401
Not authenticated: the API key is missing or not accepted. Fix the credential; there is no price yet.
402
Payment required: a price, with a way to pay it. Nothing has been charged by this answer.
403
Authenticated but not allowed, for example a blocked account or a wallet that cannot pay here.
409
Conflict: at Coronium usually a refusal before any charge (no stock, a price above max_total_usd, a plan the MPP checkout cannot fill). Read the code: an x402 409 after payment leaves the money on the account balance, and payment_under_review means do not pay again.
202
Accepted: the work is still running. On account credit the payment was taken; on x402 it may still be confirming on chain. Check the order; do not pay again.

Coroniumโ€™s agent manual adds one rule that saves a lot of bugs: branch on the HTTP status, not on the error text in the body.[8]

How an agent should handle a 402

Treat it as a quote

  • Decode the challenge (MPP) or the PAYMENT-REQUIRED header (x402) and read the amount, currency, merchant and expiry.
  • Check the units: Coroniumโ€™s MPP amount is in cents, the x402 amount is in USDC base units.[6][7]
  • Show the person the plan and the exact total, and wait for a clear yes.[8]

Pay once

  • Resend the same request: same URL and body, the same Idempotency-Key on MPP and account-credit routes, the same signed payment on x402.
  • After a timeout or a 202, check the first order before anything else.
  • Keep client spending caps at the approved total.

The controls behind โ€œpay onceโ€ are in spending limits and idempotency keys for AI agents, and the two protocols side by side in Stripe MPP vs x402.

Frequently asked questions

What does HTTP 402 Payment Required mean?

RFC 9110, the current HTTP standard, says only that the 402 status code is reserved for future use. Payment protocols for agents now give it a concrete meaning: this resource has a price, and here is how to pay it.

Is a 402 an error?

For an agent it is a quote. In both MPP and x402 the first request without payment answers 402 with the price and charges nothing. The agent should show the price to the person and pay only after a yes.

Which header carries the price?

MPP puts a challenge in WWW-Authenticate: Payment. x402 puts base64 JSON in a PAYMENT-REQUIRED header. A client can tell the two protocols apart from that alone.

Why do I get 402 from an API I already pay for?

Outside these protocols, some services return 402 for an empty balance or an expired plan. Read the body and headers: if there is no Payment challenge and no PAYMENT-REQUIRED header, it is that serviceโ€™s own billing message.

Should an agent retry a 402 automatically?

Not by paying. Paying a fresh challenge after an uncertain earlier attempt can pay twice. mpp.dev says to reconcile an uncertain payment before paying a fresh challenge, and Coroniumโ€™s x402 guide says never to sign a second payment after a 202 or a timeout.

Sources

Every technical statement above was checked against these pages. When a page here and the live API disagree, the live API wins.

  1. [1] IETF. RFC 9110: HTTP Semantics, section 15.5.3 (402 Payment Required). June 2022.
  2. [2] mpp.dev. HTTP 402 in the Machine Payments Protocol. read 3 December 2026.
  3. [3] mpp.dev. MPP transports: HTTP, MCP and WebSocket bindings. read 3 December 2026.
  4. [4] x402 Foundation. x402 specification: HTTP transport (v2). read 3 December 2026.
  5. [5] Stripe. Machine payments (documentation). read 3 December 2026.
  6. [6] Coronium. x402 buyer guide. read 3 December 2026.
  7. [7] Coronium. Stripe MPP buyer skill. read 3 December 2026.
  8. [8] Coronium. agent.md: everything your AI agent needs to run your account. read 3 December 2026.
  9. [9] Coronium. Buyer API schema (OpenAPI, API version 3.4.1). read 3 December 2026.

Start with your agent

Copy the master prompt into Claude, ChatGPT, Cursor or any agent. It is agent.md itself, and it asks for your yes before any money moves.

Give your AI agent full control of your Coronium account

One prompt covers everything: getting an API key, finding a plan, paying (account credit, card, crypto, Stripe MPP or x402 in USDC), connection details, rotation, health checks, replacing a faulty line, renewals, auto-renew, cancelling with a refund to the balance, webhooks and tickets. Paste it into Claude, ChatGPT, Cursor or any agent. It asks for your yes before any money moves.

agent.mdAgents page

No account yet? The agent can open one without a browser. The account starts empty: nothing is included until it is paid for. A wallet-only agent can skip this and pay with x402, which opens the account on the first payment.

bash
API=https://api.coronium.io/api/v3
# 1. Open the account (an email the person controls; the password is generated locally)
curl -s -X POST $API/signup -H 'Content-Type: application/json' \
  -d '{"login":"<email>","password":"<generated>","name":"My agent"}'
# 2. Login token (add "code" when two-factor authentication is on)
curl -s -X POST $API/get-token -H 'Content-Type: application/json' \
  -d '{"login":"<email>","password":"<generated>"}'
# 3. The 365-day API key (this one route is on /api/v1)
curl -s -H "Authorization: Bearer $LOGIN_TOKEN" https://api.coronium.io/api/v1/account/api-token

The full walkthrough, with the purchase: let an AI agent sign up and buy a mobile proxy by API.

Agentic payments guides

How AI agents sign up, pay and run dedicated mobile proxy lines, with the person approving every total.