docs · quickstart

Verge in 60 seconds.

Monetize any HTTP endpoint with USDC on Solana. No accounts, no API keys.

1. Install

npm install @verge/express

2. Drop in the middleware

import express from "express";
import { paywall } from "@verge/express";

const app = express();

app.use("/api/premium", paywall({
  amount: 0.001,                   // USDC
  recipient: process.env.WALLET,
  network: "solana-mainnet",
}));

app.get("/api/premium", (req, res) => {
  res.json({ ok: true, message: "unlocked" });
});

app.listen(3000);

3. Test the 402 flow

Without payment, your endpoint will challenge:

curl -i http://localhost:3000/api/premium

HTTP/1.1 402 Payment Required
WWW-Authenticate: x402 realm="verge", nonce="8f3c2d", amount="0.001", …
X-Pay-Recipient: 7Aa3…q9Px
X-Pay-Amount: 0.001
X-Pay-Nonce: 8f3c2d

{
  "error": "Payment required",
  "challenge": { … }
}

The agent pays USDC with the nonce as memo, then retries:

curl -i http://localhost:3000/api/premium \
  -H "X-Pay-Tx: 5K4f…3Ax" \
  -H "X-Pay-Nonce: 8f3c2d"

HTTP/1.1 200 OK
{ "ok": true, "message": "unlocked" }

Self-hosted (0% fees)

Provide your own Solana RPC and verify locally:

paywall({
  amount: 0.001,
  recipient: process.env.WALLET,
  rpcUrl: "https://your-helius-endpoint?api-key=…",
});

Reference

▸ early access

We're onboarding 100 endpoints before mainnet launch — 0% fees on your first 1M requests.

Get on the list →