# x402

Category: Commerce

## Goal
Add x402 payment middleware to your API routes so AI agents can pay for access via HTTP. Use `@x402/express`, `@x402/hono`, or `@x402/next` middleware with a facilitator URL and wallet address. Protected routes will return HTTP 402 with payment requirements that agents can fulfill automatically.

## Validation
- Use public machine-readable artifacts where the standard expects them.
- Confirm content types, payload shape, and discoverability from the public web surface.
- Keep the implementation read-only from the scanner perspective.

## Copyable Fix Prompt
```text
Fix the x402 gap for https://example.com.

Requirements:
- Add x402 payment middleware to your API routes so AI agents can pay for access via HTTP. Use `@x402/express`, `@x402/hono`, or `@x402/next` middleware with a facilitator URL and wallet address. Protected routes will return HTTP 402 with payment requirements that agents can fulfill automatically.
- Preserve existing product behavior and do not do UI work.
- Use machine-readable public artifacts under /.well-known/ or response headers when appropriate.
- Add or update automated tests covering the new behavior.
- Validate the final response shape and content types.
```