Skip to main content

Behavior

  • 200: returned directly
  • 402: automatically signs and retries; final response is returned
  • Other errors: original response is passed through

Return

  • Same as native fetch, returns a Response object

Retry flow

  1. First request → if 402 (with accepts)
  2. Choose PaymentRequirements by selector/default strategy
  3. Create and sign PaymentPayload (matching requirements)
  4. Attach X-Payment header and retry automatically
  5. Return the final response (200/402/other)