
Product
Socket Threat Intel Now Shows Which Malware Campaigns Were Blocked or Detected
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.
@suverselabs/x402-server
Advanced tools
x402 server middleware for Node.js (Express + Fastify). Issues 402 Payment Required challenges, verifies + settles via a remote facilitator, exposes the payment metadata to your handler.
Express and Fastify middleware that turns any HTTP route into a paid
endpoint, settling stablecoin payments through a remote x402
facilitator (default: https://facilitator.suverse.io).
client middleware facilitator
│ │ │
├── GET /paid ─────────▶│ │
│ ├─ no X-Payment → 402 ─◀─────│
│◀── 402 + challenge ───┤ │
│ │ │
│ (signs USDC payment) │ │
│ │ │
├── GET /paid + X-Payment ▶│ │
│ ├── POST /facilitator/verify ▶│
│ │◀────── { isValid: true } ──┤
│ ├── POST /facilitator/settle ▶│
│ │◀── { success:true, tx:0x.. }┤
│◀── 200 + your handler ┤ │
npm install @suverselabs/x402-server
# Peer deps: install whichever you use
npm install express # for the Express adapter
npm install fastify # for the Fastify adapter
import express from "express";
import { createExpressMiddleware } from "@suverselabs/x402-server/express";
const app = express();
app.use(
"/paid",
createExpressMiddleware({
apiKey: process.env.SUVERSE_PAY_API_KEY!,
facilitator: "https://facilitator.suverse.io",
acceptedPayments: [
{
scheme: "exact",
network: "eip155:8453",
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
payTo: "0xYourReceiveAddress",
maxAmountRequired: "100000", // $0.10 USDC (6 decimals)
},
],
description: "Cool paid API",
}),
);
app.get("/paid", (req, res) => {
// req.x402Payment is populated by the middleware
res.json({
result: "data",
payer: req.x402Payment?.payer,
txHash: req.x402Payment?.txHash,
});
});
app.listen(3000);
import Fastify from "fastify";
import { createFastifyPreHandler } from "@suverselabs/x402-server/fastify";
const app = Fastify();
const x402 = createFastifyPreHandler({
apiKey: process.env.SUVERSE_PAY_API_KEY!,
facilitator: "https://facilitator.suverse.io",
acceptedPayments: [
{
scheme: "exact",
network: "eip155:8453",
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
payTo: "0xYourReceiveAddress",
maxAmountRequired: "100000",
},
],
});
app.post("/paid", { preHandler: x402 }, async (request) => {
return { result: "data", payer: request.x402Payment?.payer };
});
await app.listen({ port: 3000 });
| Option | Required | Default | Meaning |
|---|---|---|---|
apiKey | yes | — | Resource API key from the Suverse Pay dashboard (sup_live_*). |
facilitator | yes | — | Base URL of the facilitator. |
acceptedPayments | yes | — | Non-empty array of { scheme, network, asset, payTo, maxAmountRequired }. |
description | no | — | Public text shown in the 402 challenge. |
x402Version | no | 2 | Protocol version to advertise. |
settle | no | true | If false, verify only (no on-chain settle). |
fetchImpl | no | global fetch | Inject your own fetch (testing, custom TLS). |
logger | no | silent | Pass a pino/winston-style logger for warn/error. |
After a successful payment the middleware attaches a PaymentReceipt
to req.x402Payment (Express) / request.x402Payment (Fastify):
{
payer: "0x09939648B56A776de9783eaE750A7fBE725761f1",
network: "eip155:8453",
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
amount: "100000",
txHash: "0xabc..." | null, // null in verify-only mode
raw: { /* full facilitator response */ },
}
If the facilitator is unreachable or the payment payload is malformed, the middleware writes a 4xx/5xx JSON body with the x402 challenge included so a well-behaved client can immediately retry. The seller's handler is not invoked.
Wire-level errors thrown to your error handler are instances of
X402Error — re-export from the root entry:
import { X402Error } from "@suverselabs/x402-server";
app.use((err, req, res, next) => {
if (err instanceof X402Error) {
/* log err.code, err.statusCode */
}
next(err);
});
Apache-2.0
FAQs
x402 server middleware for Node.js (Express + Fastify). Issues 402 Payment Required challenges, verifies + settles via a remote facilitator, exposes the payment metadata to your handler.
The npm package @suverselabs/x402-server receives a total of 0 weekly downloads. As such, @suverselabs/x402-server popularity was classified as not popular.
We found that @suverselabs/x402-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.

Security News
Fixes for eMudhra and Brotli are out. Getting them everywhere they’re needed means tracking down bundled libraries, runtimes, and certificate stores.

Threat Research
/Security News
Socket uncovered secret-stealing workflows that ran in LiteLLM’s GitHub repository 11 days before the supply chain attack on PyPI and Docker.