-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Add x402 Micropayment Support for Agent-to-Agent Transactions
Description
Implement x402 protocol support to enable blockchain-agnostic micropayments between agents using HTTP 402 status code. This allows agents to monetize their services and creates foundation for multi-agent economies where agents can discover, evaluate, and compensate each other for services.
x402 integrates with existing A2A/SLIM communication - when an agent requests a paid service, the server responds with 402 Payment Required, client submits payment proof, server verifies on-chain, and processes the request.
Implementation Approach
- Create x402 middleware layer that wraps protocol endpoints
- Implement payment verification via blockchain facilitator
- Add payment metadata to AgentCard/AgentFacts (
payment_methods,pricing) - Support payment headers:
X-PAYMENT-REQUEST(client) andX-PAYMENT-RESPONSE(server) - Handle HTTP 402 response flow with payment requirements
- Integrate with blockchain networks (Ethereum, Polygon, etc.) via facilitator service
- Make payment optional/configurable per agent and per capability
Acceptance Criteria
- x402 middleware intercepts requests and checks for payment headers
- Server returns HTTP 402 with payment details when payment required
- Client can submit payment proof in
X-PAYMENT-REQUESTheader - Payment verification via blockchain facilitator integration
- Settlement details returned in
X-PAYMENT-RESPONSEheader - AgentCard/AgentFacts extended with payment metadata (currencies, pricing, facilitator URL)
- Config allows enabling/disabling payments per agent:
payment.enabled,payment.required_for - Support multiple blockchains (Ethereum, Polygon, etc.)
- Payment verification includes on-chain transaction validation
- Graceful handling of payment failures with error details
- Payment logs for auditing and reconciliation
- Documentation for setting up payment-enabled agents
- Tests for payment flow: 402 response, payment submission, verification, settlement
References
Metadata
Metadata
Assignees
Labels
No labels