Tools
Ship an x402 API in five minutes
Pure client-side templating for Express, Next.js, or Hono. Pick network and price, paste payTo, copy install + middleware. Nothing you type leaves the browser.
Have a URL? Run 402 Checker →Schemas improve discovery in the x402 Bazaar. Nothing you type is uploaded.
Showing a sample snippet. Enter your real payTo address to personalize it.
// @x402/express v2 shape — from docs.x402.org seller quickstart
// Verify against https://docs.x402.org before production (APIs evolve).
import express from "express";
import { paymentMiddleware, x402ResourceServer } from "@x402/express";
import { HTTPFacilitatorClient } from "@x402/core/server";
import { ExactSvmScheme } from "@x402/svm/exact/server";
const app = express();
const payTo = process.env.X402_PAY_TO!; // So1anaExamp1eAddress1111111111111111111111
const facilitatorClient = new HTTPFacilitatorClient({
url: process.env.X402_FACILITATOR_URL ?? "https://x402.org/facilitator",
});
app.use(
paymentMiddleware(
{
"GET /api/premium": {
accepts: [
{
scheme: "exact",
price: "$0.01",
network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
payTo: payTo,
},
],
description: "Premium API access",
mimeType: "application/json",
},
},
new x402ResourceServer(facilitatorClient)
.register("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", new ExactSvmScheme()),
),
);
app.get("/api/premium", (_req, res) => {
res.json({ ok: true, message: "Paid access granted" });
});
app.listen(3000);Templates use @x402/* v2 (routes + x402ResourceServer, CAIP-2 networks). Packages: @x402/express, @x402/next, @x402/hono. Verify signatures against docs.x402.org before production.