Skip to content

feat: add custom paymentFetch option to proxy#43

Closed
matiasedgeandnode wants to merge 2 commits into
BlockRunAI:mainfrom
edgeandnode:ma/custom-proxy
Closed

feat: add custom paymentFetch option to proxy#43
matiasedgeandnode wants to merge 2 commits into
BlockRunAI:mainfrom
edgeandnode:ma/custom-proxy

Conversation

@matiasedgeandnode

@matiasedgeandnode matiasedgeandnode commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds optional paymentFetch parameter to startProxy() for custom payment handlers
  • Enables integration of alternative payment systems (spend limits, budget enforcement, etc.)
  • Falls back to built-in x402 payment handler when not provided

Test plan

  • Verify existing behavior unchanged when paymentFetch is not provided
  • Test custom paymentFetch function is called when provided

🤖 Generated with Claude Code

@VickyXAI

Copy link
Copy Markdown
Contributor

Thanks Matias — closing as superseded rather than rejected.

The stated motivation (spend limits, budget enforcement) is now native: main ships src/spend-control.ts with a full SpendControl class covering perRequest/hourly/daily/session windows with file and in-memory storage. And the diff no longer applies — it patches ProxyOptions around line 814 (now ~1308) and calls createPaymentFetch(), which was deleted in the @x402/fetch rewrite.

For the record on design: options.paymentFetch ?? createPaymentFetch(...) is a total-replacement seam on the money path — caller code could sign anything, to anyone, for any amount. If a hook is still wanted, #205's abort-only beforePayment is the safer shape.

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.

2 participants