How to Verify AI Agent Payments for x402 Endpoints
· 3 min read
To verify an AI agent payment on x402, check two things: the quote before your agent pays, and the response after. Lumière PayCheck does both. It tells your agent whether an endpoint is safe to pay, and its SDK checks that the paid response delivered what the listing promised.
How an x402 payment works
x402 lets an API charge an AI agent per call, in USDC, with no account or API key:
- Your agent calls the API.
- The API answers
402 Payment Requiredwith a quote: the price, the network, the token and the wallet to pay (payTo). - Your agent pays that quote and sends the request again with proof of payment.
- The API returns the data.
It's simple, and that's the risk. A quote only asks for money. It doesn't prove the endpoint will deliver, that the wallet is the seller's real one, or that the price is what it usually charges.
What can go wrong
- The payout wallet changed. A swapped
payTois how a hijacked endpoint usually shows up first. - The price jumped. The quote asks for more than this endpoint normally charges.
- The payment goes through, but the data doesn't. The endpoint answers
200with an error, an empty body, or the wrong fields. In our tests, most bad calls still charged the buyer, and few were refunded.
Your agent can't spot any of this from the quote alone.
Step 1: check before your agent pays
Lumière PayCheck monitors more than 130,000 x402 endpoints, about every 30 minutes. It checks that each quote is valid, that the price and payout wallet stay stable, and that the endpoint answers. It also makes real paid test calls, flags lookalike sellers, and screens wallets against the OFAC sanctions list.
Before paying, your agent sends the quote's details and gets a clear answer:
- REST:
POST /v1/check-paymentwith theurl,amountandpayTofrom the 402 quote. It returnsallow: trueorfalse, with the reasons. Pay only ontrue. - MCP: connect your agent to
https://lumierepaycheck.org/mcp, or run the npm packagelumiere-paycheck-mcp, and call thecheck_paymenttool. - Quick look:
GET /v1/score?url=<endpoint>returns the grade and verdict, or paste the URL into the free checker at https://lumierepaycheck.org/check.
These checks are free. A free API key raises your rate limit.
Step 2: verify the delivery after paying
A 200 with the wrong body passes every check on the quote. So check what came back, too.
The x402-paycheck SDK does this for you. Wrap your x402 client with wrapFetchWithPayCheck, and every paid call is checked before paying and verified after. It compares the response with the listing in the endpoint's own 402 quote, using the same rules as PayCheck's paid tests:
- an error status, an empty body, or not-JSON when the listing promises JSON is a failure;
- the response must contain the fields the listing's example shows.
The result is on client.lastDelivery. Turn on reportOutcomes: true and each result is also reported to PayCheck. A bad delivery moves that endpoint to the front of PayCheck's own paid re-test queue, so a real problem shows up in its grade quickly. Reports don't change a grade by themselves; the re-test does.
Install it with npm i x402-paycheck.
What the verdicts mean
- Proceed: monitoring and paid tests look good.
- Caution: something needs a second look, such as a recent price or wallet change, or no delivery confirmed yet.
- Avoid: the endpoint has failed checks, so paying it is likely to waste money.
Some endpoints get other labels, such as not enough data yet. Endpoints from sellers that list a very large number of near-identical endpoints show as bulk listings until each one has enough checks for its own grade.
Proof you can check
Every paid test PayCheck makes comes with a signed receipt (Ed25519). Anyone can look them up with GET /v1/test-receipts?url=<endpoint>. Live numbers from all of these tests, including which sellers refund failed calls, are at https://lumierepaycheck.org/reliability.
FAQ
Is Lumière PayCheck a payment processor? No. It never moves your money and doesn't process, route or hold payments. It tells your agent whether to pay, and your agent pays as usual.
Does checking cost anything? The pre-payment check, the web checker, the scores and the MCP checks are free. Full trust reports and bulk catalog data cost a small amount in USDC, and teams can add spend limits with a monthly plan.
What if the endpoint isn't monitored yet? Look it up anyway. If it answers with a real x402 quote, PayCheck adds it and starts checking it.
Check an x402 endpoint before your agent pays it, free, at https://lumierepaycheck.org/check.
More from the blog
How to Add x402 Payment Checks to Your MCP Server
If your AI agent pays x402 APIs through an MCP server, you can add a safety check before every payment with Lumière PayCheck's free MCP tools. The agent…
How AI Agents Pay for APIs with USDC
AI agents pay for APIs with USDC using x402: the API answers with a price, and the agent signs a USDC payment for exactly that amount and sends it with its…
x402 Seller Checklist: Verify Your Endpoint Before Buyers Pay
Before AI agents pay your x402 endpoint, many of them check it first. This checklist covers what they look at and how to get your endpoint to a proceed…