docs @ lane402
Ship a paid endpoint
in five minutes
402LANE implements x402 v2 with the exact scheme over EIP-3009 transferWithAuthorization. The buyer signs, the seller receives USDG directly on-chain, and the facilitator verifies and broadcasts. It never holds funds.
1 · paywall your api
import express from "express";
import { lane402 } from "@402lane/middleware";
const app = express();
app.use("/api", lane402({
price: "0.001", // USDG per request
payTo: "0xYourAddress", // you get paid here, directly
network: "eip155:4663", // or eip155:46630 for testnet
// facilitatorUrl defaults to the hosted 402LANE facilitator
}));
app.get("/api/report", (_req, res) => res.json({ paid: true }));
app.listen(4021);Requests without payment get an HTTP 402 with a PAYMENT-REQUIRED header. Paid responses carry a PAYMENT-RESPONSE header with the settlement tx hash.
2 · pay from code
import { createSigner, payingFetch } from "@402lane/client";
const pay = payingFetch({
account: createSigner(process.env.WALLET_KEY),
maxValue: 10_000n, // spend cap per request: 0.01 USDG
});
const res = await pay("https://api.example.dev/report");
// 402 → signs EIP-3009 authorization → retries → 2003 · charge agents per tool call
{
"mcpServers": {
"paid-tools": {
"command": "lane402-mcp-proxy",
"args": ["https://your-paid-mcp.example/mcp"],
"env": {
"402LANE_PRIVATE_KEY": "0x…",
"402LANE_MAX_VALUE": "10000"
}
}
}
}The proxy bridges stdio MCP to your paid HTTP endpoint and settles each tool call in USDG. Handshake and tool discovery stay free. Only tools/call is billed.
network reference
| Network | CAIP-2 | RPC | USDG |
|---|---|---|---|
| Robinhood Mainnet | eip155:4663 | https://rpc.mainnet.chain.robinhood.com | 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 |
| Robinhood Testnet | eip155:46630 | https://rpc.testnet.chain.robinhood.com | testnet USDG TBD |
EIP-712 domain: name "Global Dollar", version "1" · 6 decimals · gas paid in ETH · Arbitrum Orbit L2 with sub-second block times.
facilitator api
| GET | /supported | schemes + networks this facilitator services |
| POST | /verify | { paymentPayload, paymentRequirements } → { isValid, payer } |
| POST | /settle | verifies, then broadcasts transferWithAuthorization → { transaction } |
| GET | /events | SSE stream of verify/settle lifecycle events |
| GET | /healthz | liveness + mode |
Verification checks, in order: requirement match → time window → EIP-712 signature recovery → on-chain authorization replay state and payer balance. Settlement broadcasts the buyer's signed authorization; funds move payer → payee in one transaction.

