OceanAltOceanAlt

Q&A

x402 paid APIs: what should an agent check before paying?

x402 lets an agent pay automatically the moment it hits a 402 response — and precisely because it's automatic, the pre-payment checks must be done by code. Three steps minimum: ① screen the endpoint — is this URL a known phishing or spoofed host (malicious-domain corpus match); ② screen the payee address — sanctions, freeze and scam lists; ③ verify the payment requirements themselves — are the amount, chain and payee in the 402 response self-consistent, or tampered with in transit. OceanAlt ships all three as free APIs, and an allow verdict carries a signed attestation you can bind to the payment record.

Why the order is endpoint, then address, then requirements

The attack surface is layered. A spoofed endpoint hands out a freshly generated payee address that no list will ever flag — so the endpoint gets checked first. A genuine endpoint with a dirty payee address is the second layer. With both clean, what remains is a tampered requirement: if the 402 payload was altered in transit — amount or payee swapped — the first two checks never notice.

Three ways to wire it in

HTTP: GET /api/endpoint?url=… for the endpoint; POST /api/decide for the payee address (allow/review/decline); POST /api/x402/verify-requirements for the 402 payment requirements. All free and keyless; docs at oceanalt.com/en/api-docs.

MCP: agents in the Claude ecosystem can install oceanalt-aml-mcp (one npm command) and get screening and decisions as native tools inside the payment flow.

After the decision, bind the attestation from the response into the payment memo or your execution record — later, anyone can verify that this payment passed its pre-payment checks.

The boundary

These three steps govern who you pay and on what terms. They do not judge whether the service is worth buying — quality, fulfilment and refunds belong to a different layer (delivery trust), covered by the provider's reputation and your trial policy.

Where to start: free address check · API docs · watch an address

Boundary of everything above: a screening "clear" only means no match in the data held, never a safety guarantee; this page is not legal or compliance advice.