{ "error": "WRONG_PREIMAGE", "code": 402, "cause": "SHA256(preimage) does not match paymentHash in macaroon", "action": "check_wallet_payment", "retry": false}
import { l402 } from "l402-kit/agent";try { const res = await client.fetch("https://api.example.com/data");} catch (err: any) { if (err.error === "BUDGET_EXCEEDED") { // stop and report to user } else if (err.retry === true) { // safe to retry after short delay await sleep(1000); const res = await client.fetch("https://api.example.com/data"); }}