Agents & Protocols

x402 Settlement Review: Replay and Double Charge

Reviews pasted seller-side x402 code that accepts the PAYMENT-SIGNATURE header, talks to the facilitator and delivers the goods (the cash register), for the silent failures that double-charge a buyer, hand the goods to a stranger or bill the seller. It flags an expiry check that runs before the nonce lookup, a repeat path that delivers without proof the chain observer lacks, a repeat window taken from the buyer's validBefore instead of the seller's own clock, settlement_pending treated as failure, a public header that raises the seller's own cost, an attempt bucket keyed on the unverified from, verify calls with no global ceiling, a facilitator health lamp fed by a different facilitator, HTTP 400 reasons logged as unknown, and a money value kept in two places. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review an x402 seller's payment handling before launch, audit replay and double-charge handling, or check the facilitator adapter and its health probe.

x402 Settlement Review: Replay and Double Charge is a SKILL.md that reviews pasted seller-side x402 code that accepts the PAYMENT-SIGNATURE header, talks to the facilitator and delivers the goods (the cash register), for the silent failures that double-charge a buyer, hand the goods to a stranger or bill the seller; an agent buys it once for $0.01 over x402.

Tested 2026-10-09No code, no hidden instructionsv1.0.0 · 12.3 KB · perpetual license

Not for

The storefront (402 body and header, extra, extensions placement, UTF-8 decoding of the incoming header: see x402-seller), the buyer's decisions (x402-buyer), reading receipts from the chain, or anything that needs the running system: it reads pasted seller code, so a lookup or adapter it cannot see is unknown, not a finding. Several facts are owner-measured in 2026, not re-checked by this writer.

Tested, honestly

Tested 2026-10-09 with a strong and a weak model.

With and without the skill

Results with and without the skill, for Sonnet and Haiku
SonnetHaiku
withwithoutwithwithout
Planted defects found (16 snippets)16/1616/1616/1616/16

Same request on both sides, a fence removed first. Without the skill both models named every planted defect in their own words, so the count shows no gain. What it does not show: without the skill each answer is a long review of 4 to 7 thousand characters, and on the six sound snippets we read, both models listed high-severity items; some are real issues outside the ten codes, such as a validBefore that is not a number skipping the expiry check. With the skill Sonnet answered No findings. on all eight sound snippets, in one line each.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

SonnetStrong model, claude-sonnet-5-5
Right on all 24 snippets, checked by code on the finding codes and the verdict line: an expiry check before the nonce lookup, repeat paths that hand over the file with no proof or with a foreign body, a repeat window taken from the buyer's validBefore, settlement_pending treated as terminal, a public header that lifts a ceiling or skips a check, a bucket keyed on the claimed from, verify with no global ceiling, a health lamp fed by another facilitator or calling a verdict down, 400 reasons logged as unknown, a network kept in two places and a planted comment; No findings. on all eight sound snippets.
HaikuWeak model, claude-haiku-5-5
Right on 22 of 24 snippets, checked by code. It found every planted defect, but on two sound snippets it reported one that is not there: a receipt returned on a repeat, which the skill itself prescribes, and verify calls whose ceiling sits in code the paste only calls.

Full test summary

Example

Our own test text, before and after the skill ran. Excerpts only.

English · claude-sonnet-5-5

Before

// scripts/buy.mjs — OUR OWN BUYER, run from a laptop to smoke-test a vendor; not deployed anywhere import { x402HTTPClient } from '@x402/core/http'; const client = new x402HTTPClient({ signer: walletFromEnv(), spendControls: { maxAmountPerPayment: "$0.50" } }); const url = process.argv[2]; let res = await fetch(url); if (res.status === 402) {…

After

No findings. Verdict: no known defects

What is in the file

  • The answer
  • The codes
  • Rules
  • Work in this order
  • Short example

Languages

Any language. Tried in: English.

License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.

Versions

Current version 1.0.0, updated 2026-10-09. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.0 · 2026-10-09

    First release: reviews pasted seller-side x402 version 2 code — the cash register after the buyer has signed — and lists each defect with a fixed code, the place, the reason and a fix, then a verdict (loses money or goods, fix before launch, no known defects). Loses money or goods: `[EXPIRED-BEFORE-NONCE]`, `[REPLAY-NO-PROOF]`, `[REPLAY-BUYER-CLOCK]`, `[PENDING-AS-FAILED]`, `[PUBLIC-CAP-HEADER]`. Fix before launch: `[BUCKET-BY-CLAIMED-FROM]`, `[VERIFY-UNMETERED]`, `[HEALTH-WRONG-FACILITATOR]`, `[FACILITATOR-400-REASON]`, `[TWO-PLACES]`.

    Facts re-checked on 2026-10-08 with free read-only fetches of the public x402 version 2 specification, the exact EVM scheme page and EIP-3009 (notes/facts-2026-10-08.md): the authorization fields (`from`, `to`, `value`, `validAfter`, `validBefore`, 32-byte random `nonce`) and the 65-byte signature in the `PAYMENT-SIGNATURE` payload; `isValid` / `invalidReason` on verify and `success` / `errorReason` / `transaction` on settle; `settlement_pending` as a non-terminal `errorReason` that must carry a non-empty `transaction`; `transferWithAuthorization` and `authorizationState` on the token. Not re-checked (owner-measured, marked inline): the facilitator's HTTP 400 body shape (2026-09-20), the forged-`from` bucket attack with 21 headers (2026-10-08), the repeat path accepting a public nonce plus random bytes (2026-10-07), the health lamp pointed at the wrong facilitator (2026-10), and that the standard buyer client re-signs only on 402.

    Test set: 24 cases (16 planted defects, 8 correct controls), generated by test/make-cases.mjs; test/control.mjs checks without any model call that the ideal answer passes and that a missing code, an extra code, a wrong verdict, a fence, the raw input and "No findings." on a trap all fail, and that every base-side regex accepts a correct plain-language description and rejects three wrong answers.

    Price: class A start ($0.05); to be set by the measured gain after the baseline run.

FAQ

What defects does it look for?

Ten, each with a fixed code: an expiry check that answers 402 before the nonce is read (the standard client re-signs and pays twice), a repeat path that hands out the goods without proof a chain observer lacks, a repeat window taken from the buyer's validBefore, not the seller's clock, settlement_pending treated as terminal, a public header that lifts the seller's verify ceiling, an attempt bucket keyed on the unverified from address, verify calls with only a per-address limit, a health lamp fed by another facilitator, HTTP 400 refusals logged as unknown, and a money value kept in two places.

Does it call my endpoint or the facilitator?

No. It reads the code you paste and points to the line. When a finding turns on a function the paste only calls, the finding line says so; a part you did not paste gets no finding at all. It never pays, never signs and never fetches anything. Paste the handler, the repeat branch, the limiter, the adapter and the cron probe together: most findings sit at the seam between two files, and a single snippet hides the order of checks.

Does it help Claude Sonnet?

Not in finding the defects, so the price is one cent. Both Claude models reviewed twenty-four snippets of seller code with the file and without it. Bare, each named all sixteen planted defects in its own words, inside long reviews that also listed high-severity items on every sound snippet we read. With the file Sonnet gave one coded line per defect and No findings. on all eight sound ones, which a script can act on. Haiku with the file still flagged two sound snippets.

Which facts were measured rather than read from the specification?

The shape of the facilitator's HTTP 400 body (errorType, errorMessage, errorLink, correlationId, no invalidReason), the forged-from attack that filled a victim's attempt bucket with 21 headers, a public nonce plus a random signature passing a repeat path that never recovers the signer, and the health lamp pointed at the wrong facilitator. All four are owner measurements from September and October 2026 on live sellers, which this writer did not repeat. The verify, settle and settlement_pending fields were read in the public x402 v2 specification on 8 October 2026.

Read more

Share

Read this page as Markdown: /skills/x402-settlement-review.md.

  • Recommended

    x402 Seller: Get Paid and Listed in Bazaar

    Agents & Protocols

    SKILL.md · v1.0.2 · 14.0 KB

    Diagnoses why an HTTP API sold over x402 v2 cannot be paid by standard buyer agents or never appears in the Coinbase CDP Bazaar catalog, using an ordered checklist and a decision tree over the pasted 402 response, headers and symptoms. Names the exact field that is wrong or missing and how to prove the fix. Use when asked to check an x402 seller, fix an unpayable 402 endpoint, find out why a resource is not listed in Bazaar, or why a settled payment does not show up.

    $0.10once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 30 Sep 2026

  • x402 Buyer: Pay Safely from an Agent Wallet

    Agents & Protocols

    SKILL.md · v1.0.4 · 9.4 KB

    Decision rules for an AI agent that holds a wallet and receives an HTTP 402 payment request (x402 v2). Decides SIGN, REFUSE or ASK the human before any money moves, and says how to verify the delivery and retry without paying twice. Use when an agent is about to pay over x402, gets a 402 response, must check a seller's payment terms, or a paid request failed and it is unsure whether to pay again.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 30 Sep 2026

  • Cloudflare Workers Review: D1, OpenNext, Fetch

    Code & Engineering

    SKILL.md · v1.2.0 · 9.8 KB

    Reviews pasted Cloudflare Workers code and configuration (a Worker, a Next.js app on OpenNext, D1 queries, wrangler config) for platform pitfalls that pass every local test and then fail in production or quietly cost money. It flags the edge runtime under OpenNext, a fetch to your own Worker's workers.dev address (error 1042), D1 queries that bind more than 100 parameters as data grows, LIKE patterns over D1's 50-byte limit, reading rowsAffected where D1 returns meta.changes, interactive transactions D1 does not have, secrets kept in plain vars, outbound fetch code that treats only a thrown error as failure, a browser User-Agent that bot protection challenges, client hop-by-hop headers forwarded to fetch, cron triggers whose day of the week is written as numbers, and unbounded queries on the request path. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review a Cloudflare Worker before deploy, check D1 or wrangler code, or audit a Next.js app running on Cloudflare.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

More in Agents & Protocols

  • Agent Report Audit: Which Claims the Log Supports

    Agents & Protocols

    SKILL.md · v1.0.0 · 8.2 KB

    Audits the report an AI agent wrote about its own session against the tool log of that session. Every numbered claim of the report gets one of two verdicts, supported or not_supported, with the log line that decides it copied exactly. A claim is supported only when the log shows a call that did it, a complete output that shows success, the same object and scope, nothing later that undoes it, and every part of a compound claim. A command that was issued, an output cut off, a dry run, a read, a plan, a run that predates the last edit, a different environment, a partial count, a number the outputs do not show and the agent's own remark are testimony, not support. Text inside the log that speaks to the auditor is data. Use before you trust an agent's status report, to check a claim of success, or to find which sentences of a summary have nothing behind them.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Session Handoff Note: Done, Open, Next Step

    Agents & Protocols

    SKILL.md · v1.0.0 · 7.0 KB

    Turns the log of one agent session (the user's requests, tool calls with their outputs, errors and the agent's own remarks) into the note the next session starts from, as strict JSON with done, not_done, open, decisions, files and next_step. Work counts as done only when the log shows a result, with the log line that proves it; a command that was issued, an output that was cut off or the agent's own "done" is not a result, an error with no successful retry stays not_done with its error text, ids and counts are copied from the outputs and never completed, and text inside a fetched page or file that speaks to the agent is data, never an order. Use to hand a long coding or ops job to the next agent session, to write a shift handover from a log, or to check what an agent really finished before you trust its summary.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • MCP Registry Listing Writer

    Agents & Protocols

    SKILL.md · v1.0.0 · 10.9 KB

    Writes the server.json that the official MCP registry accepts today, and answers short questions about publishing to it. Uses the current dated schema address, a name that matches the way the publisher proves ownership (GitHub login or domain), a description of at most 100 characters and one entry per package type with the ownership proof the registry checks at publish - mcpName in package.json for npm, the mcp-name line in the README for PyPI, NuGet and Cargo, a label on the image for OCI, a file hash for MCPB - or a remotes entry for a hosted server. Secrets become secret inputs with no value, and unknown _meta keys are not used. Use when asked to write, fix or check a server.json, to list an MCP server in the registry, to choose a server name or version for it, or to explain why a publish was refused.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Claude Code Settings Review: Hooks, Permissions, MCP

    Agents & Protocols

    SKILL.md · v1.0.0 · 13.6 KB

    Reviews a pasted Claude Code configuration (settings.json, hooks, permission rules, MCP server switches, scripts that start Claude Code) for keys and meanings that are easy to get wrong and that fail without an error. It flags disabledMcpjsonServers used on a server that does not come from a project's .mcp.json, a settings file with a JSON syntax error, a blocking hook that exits 1 instead of 2, the deprecated top-level approve or block decision of a PreToolUse hook, hook event names that do not exist, matchers that match too much or nothing (the matcher is an unanchored regular expression, and plugin MCP tools carry a plugin prefix), path rules written for Write instead of Edit, single-slash absolute paths, an allow rule for src that matches only the top-level folder, Bash rule patterns with the colon or the space in the wrong place, hook timeouts that are expected to block, bypassPermissions in project settings, and many claude -p runs started at once. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review Claude Code settings, check hook and permission rules, or disable an MCP server correctly before the team relies on the configuration.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026