
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
proof402-middleware
Advanced tools
x402/HTTP 402 payment middleware for Express, Next.js, and Cloudflare Workers. Gate any API behind RLUSD (XRPL) or USDC (Base) micropayments via 402Proof. Sub-millisecond local HMAC verification. Zero API keys.
x402/HTTP 402 payment middleware for Express, Next.js, and Cloudflare Workers.
Gate any API behind RLUSD micropayments on XRP Ledger via 402Proof.
Sub-millisecond local HMAC verification. Zero API keys. Zero custody.
npm install proof402-middleware
X-Payment-Token headerHTTP 402 + invoice (pay_to, memo_hex, amount)POST /v1/verify on 402Proof → receives signed tokenX-Payment-Token: <token> → verified locally in <1ms → access grantedToken verification is pure HMAC-SHA256 — zero network call, sub-millisecond when tokenSecret is set.
const express = require('express');
const { proof402 } = require('proof402-middleware');
const app = express();
app.use('/api/premium', proof402({
endpointId: 'your-endpoint-uuid', // from 402Proof merchant dashboard
serverUrl: 'https://four02proof.onrender.com',
tokenSecret: process.env.PROOF402_TOKEN_SECRET, // enables zero-latency local verify
}));
app.get('/api/premium/data', (req, res) => {
res.json({ data: 'paid content', verified: req.proof402 });
});
import { proof402Next } from 'proof402-middleware';
export default proof402Next({
endpointId: process.env.PROOF402_ENDPOINT_ID!,
serverUrl: 'https://four02proof.onrender.com',
tokenSecret: process.env.PROOF402_TOKEN_SECRET,
});
export const config = { matcher: ['/api/premium/:path*'] };
import { proof402Worker } from 'proof402-middleware';
async function myHandler(request, env, ctx) {
return new Response(JSON.stringify({ data: 'paid' }), {
headers: { 'Content-Type': 'application/json' }
});
}
export default {
fetch: proof402Worker({
endpointId: 'your-endpoint-uuid',
serverUrl: 'https://four02proof.onrender.com',
tokenSecret: env.PROOF402_TOKEN_SECRET,
handler: myHandler,
})
};
When payment is required, clients receive:
{
"error": "Payment Required",
"invoice": {
"invoice_id": "inv_abc123",
"pay_to": "rGATEWAY...",
"memo_hex": "696e765f616263313233",
"amount": "0.10",
"asset": "RLUSD",
"expires_at": 1747616400
},
"instructions": {
"step1": "Send 0.10 RLUSD on XRPL to rGATEWAY...",
"step2": "Include MemoData: 696e765f... in your XRPL payment",
"step3": "POST https://four02proof.onrender.com/v1/verify with invoice_id, tx_hash, agent_wallet",
"step4": "Retry with header: X-Payment-Token: <token>"
}
}
Response headers also include X-Payment-Address, X-Payment-Amount, X-Invoice-ID, X-Memo-Hex, X-Verify-URL for machine-readable x402 compliance.
| Option | Type | Required | Description |
|---|---|---|---|
endpointId | string | yes | UUID from 402Proof merchant dashboard |
serverUrl | string | no | 402Proof server URL (default: https://four02proof.onrender.com) |
tokenSecret | string | recommended | Same TOKEN_SECRET as your 402Proof server. Enables zero-network local verification. |
PROOF402_ENDPOINT_ID=your-endpoint-uuid
PROOF402_TOKEN_SECRET=your-token-secret # from 402Proof server env
endpointId in your middleware configPROOF402_TOKEN_SECRET to the same value as your 402Proof TOKEN_SECRETpip install proof402 (see /402proof/middleware/python/)MIT © Script Master Labs
FAQs
x402/HTTP 402 payment middleware for Express, Next.js, and Cloudflare Workers. Gate any API behind RLUSD (XRPL) or USDC (Base) micropayments via 402Proof. Sub-millisecond local HMAC verification. Zero API keys.
We found that proof402-middleware 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.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.