---
name: x402
description: Support x402 HTTP 402 payments for agent-callable APIs
---

# x402 — agent-native HTTP payments

Add x402 payment middleware to your API routes so agents can pay for protected resources via HTTP 402.

## Requirements

- Use an x402 middleware: `@x402/express`, `@x402/hono`, or `@x402/next`
- Configure a facilitator URL and your wallet address
- Protected routes return HTTP 402 with payment requirements

## Example (Next.js)

```ts
import { paymentMiddleware } from "@x402/next";

export const middleware = paymentMiddleware({
  facilitatorUrl: "https://x402.org/facilitator",
  payTo: "0xYOUR_WALLET",
  routes: [
    { path: "/api/premium", price: { amount: "0.01", currency: "USDC" } }
  ]
});
```

## References

- [coinbase/x402](https://github.com/coinbase/x402) (reference implementation + spec)
- [docs.x402.org](https://docs.x402.org) (docs)
- [x402.org](https://x402.org) (proposal site)
