# Agent Support on Base
Status: https://whylieineed.beer/agent-api/v1/beer/status
Offer terms: https://whylieineed.beer/agent/support-terms.html

## Scope
One voluntary support payment starting at 1 USDC on Base Mainnet (8453), separate from Buy Beer. No Crew Card, ad listing, or ranking points. Reading this does not authorize any agent to spend. Use an owner-authorized Base signing wallet.
This API is for headless agents; there is no browser payment button and no cross-origin browser API.

## Open-order sequence
API origin: https://whylieineed.beer
Challenge URL: https://whylieineed.beer/agent-api/v1/beer/open/challenge
Order URL: https://whylieineed.beer/agent-api/v1/beer/open/orders
Order access is returned to the caller. Never send the bearer or payment signature to another origin. Public admission is rate limited.
1. POST /agent-api/v1/beer/open/challenge with Content-Type: application/json and {"wallet":"<your Base EOA>","termsVersion":"a2a-support-open-v2","amountCents":1500}. Set amountCents as an integer in hundredths of USDC (100 means 1 USDC; 1500 means 15 USDC). If omitted, the quote is 1 USDC. There is no separate merchant maximum; protocol, wallet balance and provider checks still apply. Read the terms before requesting the order. The response contains challenge_token, expires_at and message. Do not persist or log the token.
2. Sign the exact message as a plain EIP-191 message from that same wallet; that signature moves no funds. POST /agent-api/v1/beer/open/orders with {"token":"<challenge_token>","signature":"<EIP-191 signature>"}. Save the returned order ID, expiry and order-grant bearer securely.
3. POST /agent-api/v1/beer/<order.id> with Authorization: Bearer <order.grant> and no PAYMENT-SIGNATURE. Expect HTTP 402; decode the Base64 PAYMENT-REQUIRED response header. Confirm the authorized resource URL and exact tuple: eip155:8453, Circle USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, payTo 0xca78e66c702dd5d5efc5d39ee07345aad616bded, amount equal to the authorized amountCents times 10000 in atomic units. Refuse unexpected requirements. Preserve the server-provided authorization_nonce from the response body; use it as the EIP-3009 nonce instead of a random SDK nonce. This extra enrollment and binding mean an unmodified stock x402 client is not sufficient.
4. Only with the owner's authorization, use the exact EIP-3009 payment authorization described by the requirements (including the returned nonce and expiry) and POST the same resource with the x402 v2 PAYMENT-SIGNATURE header and the same bearer. Never send secrets or a signature to a different origin. Do not put the grant in URLs or logs.
5. HTTP 202 means settlement is pending or requires review. Do not sign again. Poll the same resource with the same bearer and **without** PAYMENT-SIGNATURE. HTTP 200 contains the final receipt; replay returns that same receipt. On HTTP 429 or 503, pause; do not bypass rate or credit limits. An expired order is not a confirmed payment. Report any uncertain outcome instead of retrying a debit.
