Pre-Payment HTTP 402 (L402 / x402 / MPP) Invoice & Macaroon Fraud Verifier
verify_http402_payment_challengeDecodes inbound HTTP 402 Payment Required challenges (L402 BOLT11 + Macaroon, x402 Solana USDC, MPP Base intents) to verify cryptographic payment-hash binding and block overcharge fraud. Use when auditing a 402 challenge header before an autonomous agent pays a Lightning invoice or USDC transfer; for checking on-chain Bitcoin L1 mempool feerates, use estimate_bitcoin_mempool_fees instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'www_authenticate' ('protocol_hint' defaults to 'L402'), supports '?demo=true' or L402 (15 sats), and returns HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| protocol_hint | No | Expected HTTP 402 payment protocol; defaults to 'L402' when omitted. | |
| www_authenticate | Yes | Raw WWW-Authenticate or Payment-Required HTTP header string from a 402 response. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| protocol_detected | Yes | Identified 402 settlement protocol ('L402', 'x402', or 'MPP'). | |
| overcharge_detected | Yes | True if the invoice amount exceeds the declared endpoint price ceiling. | |
| payment_safety_verdict | Yes | Authorization recommendation ('SAFE_TO_PAY' or 'REJECT_HASH_MISMATCH'). | |
| macaroon_payment_hash_matches_bolt11 | Yes | True when the macaroon caveat hash matches the BOLT11 invoice payment hash. |