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

server.ts · express
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

buyer.ts · auto-paying fetch
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 → 200

3 · charge agents per tool call

claude config · mcp via lane402 proxy
{
  "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

NetworkCAIP-2RPCUSDG
Robinhood Mainneteip155:4663https://rpc.mainnet.chain.robinhood.com0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
Robinhood Testneteip155:46630https://rpc.testnet.chain.robinhood.comtestnet 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/supportedschemes + networks this facilitator services
POST/verify{ paymentPayload, paymentRequirements } → { isValid, payer }
POST/settleverifies, then broadcasts transferWithAuthorization → { transaction }
GET/eventsSSE stream of verify/settle lifecycle events
GET/healthzliveness + 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.

Open your lane