x402 payment protocol detected

low

agent_commerce_x402

Checks if the site supports x402 protocol for agent-native HTTP payments.

What does this rule check?

The x402 protocol enables AI agents to pay for API access directly via HTTP by returning 402 Payment Required responses with payment requirements. Agents can then fulfill the payment automatically using crypto or other payment methods.

Why is this important?

Without x402 support, AI agents cannot autonomously pay for premium content or API access. This limits monetization opportunities in the agentic economy.

How to fix

Add x402 payment middleware to your API routes using @x402/express, @x402/hono, or @x402/next with a facilitator URL and wallet address.

Examples

Incorrect
GET /api/premium

HTTP/1.1 403 Forbidden

<!-- No programmatic payment option for agents -->
Correct
GET /api/premium

HTTP/1.1 402 Payment Required
Content-Type: application/json

{"payment": {"method": "x402", "amount": "0.01", "currency": "USDC"}}

Agent fix snippet

Copy this snippet and paste it into your AI coding agent to fix this issue automatically.

Add x402 middleware to your API routes:

npm install @x402/express

// In your Express app:
app.use('/api/premium', x402({facilitator: '...', wallet: '0x...'}) );