x402 Conformance
v1.6.1x402 payment safety checks: validate a 402 answer, prove a server never serves before settlement.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
x402_check_payment_required Check an x402 402 answer (P1-P7)
Sends ONE unpaid GET to an x402 paid URL and checks its 402 answer against the x402 spec (P1-P7): HTTP 402, a decodable PAYMENT-REQUIRED header (V2) or JSON body (V1), x402Version, resource, accepts[], amounts in atomic units, CAIP-2 networks, and scheme fields (EVM name/version, Solana feePayer). Never pays or signs. Use it before paying an unfamiliar x402 endpoint, or to check your own route.
| Parameter | Type | Description |
|---|---|---|
url * | string | The paid URL, http or https |
x402_demo Run the suite end to end on a built-in demo server
Runs P1-P7 and R0-R10 against a built-in demo x402 server on loopback, with no wallet, no keys and no network. fault=serve_on_any_settle shows what a failing server looks like. Use it to see what the suite checks.
| Parameter | Type | Description |
|---|---|---|
fault | string | none (default) or serve_on_any_settle |
x402_explain_check Explain a check and how to fix it
Returns what a check (S0-S4, P1-P7, F1-F11, R0-R11) tests, why it matters for the seller's money, and how to fix a failure, from the suite's FIXES.md.
| Parameter | Type | Description |
|---|---|---|
id * | string | Check id, e.g. R3 or P5 |
x402_start_facilitator_double Start the facilitator double
Starts the x402 facilitator double on 127.0.0.1 and returns its URL. Start YOUR resource server with this URL as its facilitator (for example X402_FACILITATOR_URL) and offering Solana devnet or Base Sepolia, then call x402_probe_resource_server. The double never touches a chain, key or network beyond loopback.
| Parameter | Type | Description |
|---|---|---|
port | integer | Loopback port; 0 or omitted picks a free one |
x402_probe_resource_server Probe your resource server (R0-R10)
Grades your x402 resource server under fault injection (R0-R10): it must never serve content on a /settle timeout, an HTML 502, a 503 with a success body, a non-JSON or truncated answer, settlement_pending, a failed transaction or a duplicate payment. Pays with test payloads through the facilitator double only; the URL must be on loopback and your server must use the double (x402_start_facilitator_double) as its facilitator.
| Parameter | Type | Description |
|---|---|---|
resource_url * | string | Your paid route on loopback, e.g. http://127.0.0.1:4020/paid |
network | string | Network to pay on; default auto |
x402_stop_facilitator_double Stop the facilitator double
Stops the facilitator double started by x402_start_facilitator_double.