x402 Payment Gateway:
what it is & the best options
An x402 payment gateway turns any API, MCP server or web resource into a pay-per-call service — no accounts, no smart contracts. Below: how it works, how to add one in minutes, and a curated list pulled live from the 123+ gateway & paywall projects we track.
What is an x402 payment gateway?
It's the layer that sits in front of your endpoint and enforces payment before serving a response. Built on the x402 protocol (which revives the long-dormant HTTP 402 Payment Required status code), a gateway:
- Replies with 402 Payment Required + price when a request arrives unpaid.
- Accepts a signed USDC payment from the client (human or AI agent).
- Verifies & settles it (via a facilitator), then releases the resource.
Gateway vs. facilitator (don't confuse them)
Best open-source x402 payment gateways
Curated real implementations · stars are live from GitHub · sorted by popularity.
A payments protocol for the internet. Built on HTTP.
A ready-to-deploy x402 gateway template — the fastest way to stand up a paywall in front of your API.
The Cloud-Native MCP and X402 Gateway to Run and Monetize your AI Agents and Services, as well as optimize your AI costs
[Hackathon winner]A production-ready micropayment gateway that implements HTTP 402 (Payment Required) to monetize access to historical Solana blockchain data via Old Faithful. Users pay micro-amounts in USDC to query historical transactions and blocks.
Add x402 payment support to your API in seconds. Easily accept x402 payments and sell one-time API access—all with a single configuration and no changes to your existing codebase.
Run your own payment gateway as a Docker image, or use ours online to verify and settle x402 transactions instantly.
An x402 payments protocol for the internet. Built on gRPC-Gateway reverse-proxy server which translates a RESTful HTTP API into gRPC.
A Solana-powered multi-LLM gateway with pay-per-request micropayments using the x402 protocol. Allows any app to access GPT, Claude and other LLM models through a trustless 402 Payment Required flow with on-chain verification.
Open Source x402 API Router. Instantly turn any API into a USDC pay-per-request Service for AI Agents.
Browse all 123+ gateway & paywall projects in the directory →
How to add an x402 gateway (one middleware)
The simplest gateway is the official payment middleware. Wrap a route, set a price and a receiving wallet, and point it at a facilitator — that's the whole paywall. Here's a minimal Express example:
import express from "express";
import { paymentMiddleware } from "@x402/express";
const app = express();
app.use(
paymentMiddleware(
"0xYourReceivingWalletAddress", // where USDC is paid to
{
"GET /weather": {
price: "$0.01", // charge $0.01 per call
network: "base", // settle USDC on Base
},
},
// facilitator: hosted (Coinbase CDP) or your own self-hosted URL
)
);
app.get("/weather", (req, res) => {
res.json({ forecast: "sunny" }); // only runs after payment
});
app.listen(3000); Prefer not to touch your app code? Use a drop-in proxy or template from the list above. For Next.js, Node, Python and Go versions, see the x402 SDK guide.
How to choose
Already have an API?
Add the official middleware, or front it with a proxy like x402proxy / RequestTap-Router — no rewrite needed.
Starting from scratch?
Clone a gateway template to get a working paywall + facilitator wiring in minutes.
Monetizing MCP tools?
Pick an MCP-aware gateway — see paid MCP servers for agent-pays-per-call options.
Frequently asked questions
What is an x402 payment gateway?
An x402 payment gateway is the layer that sits in front of your API, MCP server or web resource and enforces payment before serving a response. When a request arrives without a valid payment, the gateway replies with HTTP 402 Payment Required and the payment details; once the client pays (signing a USDC transfer), the gateway verifies and settles it, then lets the request through. It turns any endpoint into a pay-per-call service without you writing payment logic by hand.
Is an x402 gateway the same as a facilitator?
No, though they work together. The gateway is what your server runs to gate requests and issue 402 responses (often a middleware or proxy). The facilitator is the service that actually verifies the signed payment and settles the USDC on-chain. A gateway forwards the payment to a facilitator (hosted, like Coinbase CDP, or self-hosted) to do verification and settlement. See our facilitator list for that half of the stack.
How do I add an x402 payment gateway to my API?
The fastest path is to add the x402 payment middleware to your existing server. With the official packages you wrap your routes with one middleware call, set a price and a receiving wallet, and point it at a facilitator. Express, Hono, Next.js, FastAPI and Go are all supported. See the copyable example below, or use a drop-in proxy/template from the list if you do not want to touch your app code.
Do I need to write smart contracts to run an x402 gateway?
No. x402 settles USDC using the existing EIP-3009 transfer standard, so you do not deploy any contracts. The gateway middleware plus a facilitator handle verification and settlement for you. You only configure a price, a receiving wallet address and which chain(s) to accept.
Which chains do x402 payment gateways support?
Most gateways start on Base (USDC) because of the hosted Coinbase CDP facilitator, but the list above includes gateways for other EVM chains and Solana. If you need a specific chain, pick a gateway plus a facilitator that both support it — chain support is flagged per project above.
Can I monetize an MCP server with an x402 gateway?
Yes. Several gateways are built specifically to put a paywall in front of MCP tools so AI agents pay per tool call. See our paid MCP servers guide for MCP-specific options, or use a general gateway/proxy from the list that supports MCP endpoints.