Menu

Explorer & Settings

Tempo Explorer Submit Project
💳 x402 Infrastructure

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.

x402 payment gateway architecture: a client or AI agent calls the gateway, which verifies the USDC payment and applies the paywall before forwarding the request to your API

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)

  Payment gateway Facilitator
Runs whereIn front of your API (middleware/proxy)A separate settlement service
JobGate requests, issue 402, collect paymentVerify signature & settle USDC on-chain
You providePrice + receiving walletA URL (hosted or self-hosted)
SeeThis pageFacilitator list →

Best open-source x402 payment gateways

Curated real implementations · stars are live from GitHub · sorted by popularity.

coinbase/x402 Reference

A payments protocol for the internet. Built on HTTP.

⭐ 6.4k TypeScript ⛓ Base

A ready-to-deploy x402 gateway template — the fastest way to stand up a paywall in front of your API.

⭐ 94 JavaScript ⛓ EVM
skalenetwork/machinepal MCP + API gateway

The Cloud-Native MCP and X402 Gateway to Run and Monetize your AI Agents and Services, as well as optimize your AI costs

⭐ 33 C++ ⛓ EVM

[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.

⭐ 22 TypeScript ⛓ EVM

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.

⭐ 11 JavaScript ⛓ Base

Turn any API or MCP server into a paid service

⭐ 6 TypeScript ⛓ EVM
mogami-tech/x402-facilitator Self-hosted (Docker)

Run your own payment gateway as a Docker image, or use ours online to verify and settle x402 transactions instantly.

⭐ 6 Java ⛓ EVM

An x402 payments protocol for the internet. Built on gRPC-Gateway reverse-proxy server which translates a RESTful HTTP API into gRPC.

⭐ 5 Go ⛓ EVM
mitgajera/x402-ai LLM gateway

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.

⭐ 5 TypeScript ⛓ Solana
zpaynow/ZeroPay Open gateway

An Open x402 Payment Gateway for Humans and AI Agents.

⭐ 3 Rust ⛓ EVM

Open Source x402 API Router. Instantly turn any API into a USDC pay-per-request Service for AI Agents.

⭐ 2 HTML ⛓ EVM

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.