Spending limits and idempotency keys for AI agents that buy things
By Coronium Technical Team - - 9 minute read
An agent that can pay has two new ways to lose money: it spends more than the person meant, or it pays twice for one order because a request timed out and it tried again. Spending limits stop the first. Idempotency keys, and the discipline around them, stop the second.
The examples come from Coroniumโs buyer API, which sells mobile proxy lines to agents through account credit, Stripe MPP and x402. Part of the agentic payments for mobile proxies guide.
Contents
The two ways an agent loses money
- Overspending. The price moved, the agent picked a bigger plan, or it bought ten lines instead of one. The fix is a limit that the server, the client and the wallet each enforce.
- Paying twice. A request times out, the agent cannot tell if it went through, and it sends the purchase again. The fix is to make a retry recognisable as the same order, and never to treat a timeout as a failure.
mpp.dev puts the principle well: spend management is independent of any one payment rail, so use the mechanism of the rail you pay with and give each agent runtime the payment authority its work needs.[7]
Five layers of spending limits
No single limit is enough, because each one can be misconfigured. Stack them so any one of them refuses an order the person did not approve.
- The personโs yes AgentA clear yes to the plan, quantity, payment method and exact total before any purchase, renewal, auto-renew or top-up.[1]
- A server-side price cap Requestmax_total_usd on every buy. If the serverโs total is higher, the answer is 409 price_changed with the current quote, before any charge.[2]
- The clientโs own cap Payment clientThe official x402 fetch client refuses any payment above $1 until maxAmountPerPayment is set to the approved total.[3]
- The walletโs limits WalletLink CLI 1.6.0: $500 per spend request, $500 per day, approval within 30 minutes, and one-time tokens are single use.[6]
- The sellerโs limits Serverx402 at launch: $5,000 per payment, $20,000 per wallet in 24 hours, 30 paid requests per minute per IP and route. MPP: one line per order.[4]
What the server-side cap looks like
POST https://api.coronium.io/api/v3/payment/buy-with-account-credit
Idempotency-Key: 6b1f2c9e-0d4a-4c1e-9f3a-2a7d5e8c4b10
{"tariff_id": "<id>", "modemCount": 2, "max_total_usd": 100}
HTTP/1.1 409
{"error": "The total is $120.00, above the approved max_total_usd of $100.00. Nothing was charged.",
"code": "price_changed",
"quote": {"currency": "USD", "subtotal_usd": 120, "discount_usd": 0, "total_usd": 120, ...}}The refusal carries the current quote. The agent shows it to the person and, only after a new yes, sends the order again with the new max_total_usd.[2]
Tools that cannot spend
The cheapest limit is no payment authority at all. Coroniumโs hosted MCP server at https://api.coronium.io/mcp never spends. The local server coronium-proxy-mcp spends only with CORONIUM_TOOL_PROFILE=buyer and CORONIUM_ENABLE_SPENDING=1.[1]
Idempotency keys: one per order, reused only for that order
The buyer APIโs contract for the Idempotency-Key header:[2]
- 8 to 128 characters: letters, digits,
-and_. A UUID fits. (The Stripe routes also accept.and:.) - Reuse a key only for the same logical request: same method, full route and body. A successful answer is replayed for 24 hours.
- Use a different key for an intentional additional order.
- Without a key, an identical completed request within 180 seconds answers 409 and creates no new order.
- After a timeout, check existing orders. Do not change keys to retry uncertain work.
# First attempt times out on the client. Same key, same body, same route:
POST https://api.coronium.io/api/v3/payment/buy-with-account-credit
Idempotency-Key: 6b1f2c9e-0d4a-4c1e-9f3a-2a7d5e8c4b10
HTTP/1.1 200 OK
X-Idempotency-Replay: true
X-Idempotency-Mode: explicit
# the first order's answer, not a second orderGenerate the key before the first attempt and save it with the order, not in the retry loop. A key made inside the loop is a new key on every try, which defeats the point. Conflicts come back as 409 with a reason: request_in_progress, idempotency_key_conflict or request_outcome_unknown, and none of them creates a second order.[2]
Retries by payment lane
Account credit, crypto balance, saved card
The Idempotency-Key contract above. One extra rule on saved-card routes: a new key does not make a new order for the same cart in the same five-minute window; the answer is the first order.[2]
Stripe MPP
The quote and the paid request must match: the same URL, exact JSON bytes, buyer, credential preference and Idempotency-Key. On a timeout keep the original order key and the grant, and check the order before asking for another approval. If the quote expired before any approval, refresh it with the same order key and body.[5] Approved one-time tokens are single use, and a consumed one needs a new spend request.[6]
x402
The signed authorization is the identity of the payment. If your client can resend the exact same request with the same PAYMENT-SIGNATURE, it is never credited twice. Wrappers such as @x402/fetch sign a new payment on every retry, so with them, do not retry.[3][4]
202, timeouts and other uncertain answers
A 202 is not a failure and never a reason to pay again. What it means depends on the lane:[2][4]
- Account credit 202: paid, still provisioning. Poll
GET /payments/{paymentId}/statusor/account/proxieswith the returnedpaymentId. Do not re-order.[2] - x402 202 settlement_pending: still confirming on chain. Resend the same request with the same signature after 10 seconds, or, with a wrapper, wait a minute, sign in with the wallet and read
GET /account/payments. After 5 minutes, open a ticket with the x402 ref.[4] - MPP 200 with awaiting_fulfillment: captured, not yet delivered. Follow
status_urluntilcompleted.[5] - A timeout with no answer: treat it as โmaybe paidโ. Check
GET /account/paymentsbefore anything else.[1]
x402 answers that say "do_not_pay_again": true in next_steps mean exactly that, and every x402 refusal before settlement says "charged": false.[4]
Checklist for an agent that buys
- Show the plan, quantity, term, payment method and exact total; wait for a clear yes.
- Create one order key, save it with the order, and send it on every attempt of that order.
- Send the approved total as
max_total_usd; set the clientโs cap to the same amount. - Branch on the HTTP status, then read the code: 200 done, 202 pending, 402 quote or payment problem, 409 refused (usually before any charge; an x402 409 after payment leaves the money on the balance).
- After a timeout or a 202, check the first order. Never send a second payment to find out.
- Keep keys, grants and proxy passwords out of chat, logs and URLs.
Where these rules sit in a full purchase: agent signup and purchase by API. How each protocol carries the payment: Stripe MPP vs x402. The MPP limits in practice: buying with Stripe MPP; the x402 ones: live discovery document.
Frequently asked questions
What is an idempotency key?
A value the client sends with a request that changes something, such as a purchase, so the server can recognise a retry of the same request and return the first result instead of doing the work twice. At Coronium it goes in the Idempotency-Key header and a successful answer is replayed for 24 hours.
Should an agent generate a new key when it retries?
No. A retry of the same order reuses the same key and the same body. A new key means a new order. The API says: check existing orders after a timeout; do not change keys to retry uncertain work.
What is the safest default spending limit for an agent?
The total the person approved for this order, enforced in several places: as max_total_usd on the request, as the clientโs own cap (for example maxAmountPerPayment in the x402 fetch client) and as the walletโs limit. The server then refuses anything above it before charging.
Does x402 use idempotency keys?
The signed payment plays that role. Resending the exact same request with the same PAYMENT-SIGNATURE is never credited twice, and an authorization that already paid another request answers 409 payment_already_used. The risk is a client that signs a new payment on retry.
Can an MCP server spend money by itself?
Coroniumโs hosted MCP server at api.coronium.io/mcp never spends. The local server spends only with the buyer profile and CORONIUM_ENABLE_SPENDING=1 set.
Sources
Every technical statement above was checked against these pages. When a page here and the live API disagree, the live API wins.
- [1] Coronium. agent.md: everything your AI agent needs to run your account. read 3 December 2026.
- [2] Coronium. Buyer API schema (OpenAPI, API version 3.4.1). read 3 December 2026.
- [3] Coronium. x402 discovery document (live limits). read 3 December 2026.
- [4] Coronium. x402 buyer guide. read 3 December 2026.
- [5] Coronium. Stripe MPP buyer skill. read 3 December 2026.
- [6] Stripe. Link CLI README (@stripe/link-cli 1.6.0). version 1.6.0, read 3 December 2026.
- [7] mpp.dev. Managing agent spend. 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.
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.
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-tokenThe 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.
- Agentic payments for mobile proxiesHow an AI agent signs up, gets a quote, pays with Stripe MPP or x402 and receives a dedicated line, with the person approving the total.
- Stripe MPP vs x402Card through a Stripe Link wallet or USDC from a wallet on Base: headers, approval and limits side by side.
- Let an AI agent sign up and buy by APISignup, login token, 365-day API key, plan lookup and a capped purchase, step by step.
- HTTP 402 Payment Required for AI agentsWhat the status code means today and how MPP and x402 each carry a price in it.
- Buying a mobile proxy with Stripe MPPQuote, Link wallet approval, receipt and delivery for one eligible line.
- Buying a mobile proxy with x402 and USDCPay from a wallet on Base with one paid HTTP request and keep the API key.