Installation
Quick Start
How It Works
The middleware intercepts requests and:- Checks for payment headers (
X-PaymentorX402-PAYMENT) - Verifies the payment signature and amount
- Stores payment info in the Hono context
- Calls
next()if valid, or returns 402 if invalid
Configuration
Minimal Setup
All Options
Accessing Payment Info
Payment information is stored in the Hono context:Response Headers
On successful verification:Error Responses
402 Payment Required
402 Verification Failed
Multi-Network Support
Accept payments across multiple networks and tokens:Advanced Mix-and-Match Config (Current API)
requirements:
PAYMENT-REQUIRED.
Tips
Hono middleware applies to routes that match the path pattern. Use
/api/* to protect all API routes, or specific paths like /premium/* for paid content.