Skip to main content
An agent that treats every payment failure the same way is an agent that either gives up too easily or burns money in a loop. This page maps every rejection code to a sensible reaction. For the wire-level definitions, see the Error & Rejection Codes reference.

Reaction table

Idempotency

fetchWithPayment treats each attempt as independent. If you retry after a rejection, you sign a new authorization; the previous one is discarded, not “redeemed.”

What to log

At minimum, log the tuple (resource, code, amount, txHash?). Aggregating on code per-resource lets you spot degraded endpoints before your budget notices.

Backoff policy

A reasonable default:
  • Transient (settlement_failed, rate_limited): exponential backoff, 3 attempts, jitter.
  • Client-fixable (amount_mismatch, price_changed, authorization_expired): 1 immediate retry, then give up.
  • Terminal (resource_gone, asset_not_supported, signature_invalid, unsupported_scheme, network_mismatch): no retry.
  • Budget (insufficient_funds): no retry until the wallet’s balance changes.