@delegare/x402 package lets merchants monetize API endpoints using the x402 protocol. It handles the 402 challenge and payment verification — settlement is handled by Delegare’s infrastructure on the Base blockchain.
Installation
Quick Start
@delegare/sdk or the Delegare MCP tools will automatically resolve the 402 challenge and pay.
How It Works
Configuration
Accessing Payment Context
After a successful payment, the middleware attaches metadata to the request:X-PAYMENT-RESPONSE header is also set on the response, allowing the agent to confirm payment was settled.
Testing with Sandbox
For development, use testnet mode:TypeScript Types
The package exports all relevant types:Related
- x402 Payments (concept) — How x402 works end-to-end
- TypeScript SDK — Agent-side
delegare.fetch()for auto-paying 402s - MCP Tools —
delegare_fetchtool for LLM agents