1. Fail closed
No X-PAYMENT should return 402 and a machine-readable challenge, not paid ledger JSON.
This packet is tailored to solsentry/solsentry-app issue #2. A no-payment public readback still shows GET /v1/x402/stats returning 200 OK with ledger JSON while also advertising X-Payment-Enforce: true. The preflight path also omits X-PAYMENT, which blocks browser x402 clients before they can retry with a proof.
No X-PAYMENT should return 402 and a machine-readable challenge, not paid ledger JSON.
OPTIONS should allow X-PAYMENT, expose payment/receipt headers, and vary on origin/request headers.
Accepted paid calls should return data plus X-PAYMENT-RESPONSE; denied calls should leak no paid payload.
GET https://api.solsentry.app/v1/x402/stats
Origin: https://solsentry.app
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type, Authorization, X-Client-ID
X-Payment-Required: true
X-Price-USDC: 0.001
X-Payment-Network: solana-mainnet
X-Payment-Protocol: x402
X-Payment-Enforce: true
{ "total_queries": 53622, "total_usdc_billed": 53.622, ... }
OPTIONS /v1/x402/stats Access-Control-Request-Headers: X-PAYMENT, Content-Type HTTP/1.1 204 No Content Access-Control-Allow-Headers: Content-Type, Authorization, X-Client-ID
The endpoint can truthfully advertise payment enforcement only after the unpaid path stops returning the protected ledger body and the preflight accepts the payment header used by x402 clients.
GET /v1/x402/stats returns 402 Payment Required, not 200.Access-Control-Allow-Headers includes X-PAYMENT, Content-Type, and any casing variant actually documented.Access-Control-Expose-Headers includes payment challenge/receipt headers such as Payment-Required, X-Payment-Required, and X-Payment-Response.Vary: Origin, Access-Control-Request-Headers.# no wallet, no signature, no paid call curl -si https://api.solsentry.app/v1/x402/stats \ -H 'Origin: https://solsentry.app' # expect: 402, payment challenge, no ledger JSON curl -si -X OPTIONS https://api.solsentry.app/v1/x402/stats \ -H 'Origin: https://solsentry.app' \ -H 'Access-Control-Request-Method: GET' \ -H 'Access-Control-Request-Headers: X-PAYMENT, Content-Type' # expect: 204 and Access-Control-Allow-Headers includes X-PAYMENT