Skip to content

Fix x402 requests blocked by API gateways - #40

Open
boundless-forest wants to merge 1 commit into
MetaMask:mainfrom
boundless-forest:agent/x402-user-agent
Open

Fix x402 requests blocked by API gateways#40
boundless-forest wants to merge 1 commit into
MetaMask:mainfrom
boundless-forest:agent/x402-user-agent

Conversation

@boundless-forest

Copy link
Copy Markdown

Adds an explicit User-Agent to x402 HTTP requests so API gateways can return payment challenges instead of blocking Python's default urllib client. This fixes real paid endpoints protected by Cloudflare without changing payment selection, signing, or settlement behavior.

Main changes:

  • Send MetaMask-Agent-Wallet-x402 by default on both challenge and paid retry requests.
  • Preserve all caller-provided headers and allow them to override the default when needed.
  • Bump the wallet skill to 7.0.2 and document the compatibility fix in the changelog.

Reviewer notes:

  • Reproduced against https://agent-api.degov.ai: the default Python-urllib/3.13 User-Agent receives HTTP 403, while an explicit User-Agent reaches the expected HTTP 402 challenge.
  • Validation passed with x402_pay.py --help, a read-only live inspect returning an eligible x402 v2 Base USDC option, and git diff --check.

…allenges instead of blocking Python urllib requests
@boundless-forest
boundless-forest marked this pull request as ready for review August 12, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant