Build x402 Micropayment Solutions for Communities
ETHCC 2026 · Cannes, France
Julio M. Cruz · Founder, PerkOS
perkos.xyz · @perk_os
The Problem: Agents Can't Pay
The Friction Is Real
Autonomous agents increasingly need to access APIs, acquire data, rent compute, and pay each other — but every existing payment rail assumes a human is on the other end.
Credit cards require KYC. Subscriptions require account creation. Even most crypto flows require complex wallet UX that agents simply cannot navigate.
What's Missing
No native agent payment primitive — no standard for machine-to-machine value exchange
Communities need micropayments — ranging from $0.001 to $10 per interaction
Existing crypto UX is too complex — wallets, gas, approvals all block automation

💡 What if paying was just... an HTTP header?
The Protocol
x402: Payment in an HTTP Header
The x402 protocol repurposes HTTP's long-dormant 402 Payment Required status code into a fully functional, standards-compatible micropayment handshake. No new infrastructure. No new wallets. Just headers.
The entire negotiation happens within the existing HTTP request lifecycle. The client never needs a redirect, popup, or manual confirmation — making it natively compatible with autonomous agents and automated pipelines.
EIP-3009
How It Works: transferWithAuthorization
// Client signs a payment authorization (off-chain)
const payment = {
  from: client.address,
  to: server.address,
  value: parseUnits("0.01", 6), // $0.01 USDC
  validAfter: 0,
  validBefore: Math.floor(Date.now() / 1000) + 3600,
  nonce: randomBytes(32)
};

// EIP-712 typed signature — no gas!
const signature = await wallet.signTypedData(
  domain, types, payment
);

// Attach to HTTP request
fetch("/api/data", {
  headers: { "X-PAYMENT": encode(payment, signature) }
});
Why EIP-3009?
🔏 Gasless Signing
The client signs an EIP-712 typed payload off-chain. No gas is spent until the server settles.
⏱️ Time-Bounded
validBefore ensures signatures expire, preventing replay attacks.
🎲 Nonce Protected
Random 32-byte nonce guarantees each authorization is unique and one-time-use.
Server-Side
Verify & Settle: 10 Lines of Middleware
// Express middleware — 10 lines to monetize any endpoint
async function x402Middleware(req, res, next) {
  const payment = req.headers["x-payment"];

  if (!payment) {
    return res.status(402).json({
      scheme: "exact",
      network: "base",
      token: USDC_ADDRESS,
      amount: "10000", // $0.01
      receiver: SERVER_WALLET
    });
  }

  // Verify signature + settle on-chain
  const result = await verifyAndSettle(payment);
  if (result.valid) next();
  else res.status(402).json({ error: "invalid payment" });
}
What Happens Server-Side
1
Challenge — if no payment header, respond 402 with required scheme, network, token, and amount
2
Verify — validate the EIP-712 signature against the expected parameters
3
Settle — call transferWithAuthorization on-chain to claim funds atomically
4
Serve — pass to next() and return the protected resource
Community Use Cases
💬 Content & Access
  • Pay-per-article and newsletter access
  • Gated Discord / Telegram channels
  • Premium API endpoints for subscribers
  • Community data feeds with per-query billing
🤖 Agent Economy
  • Agent-to-agent payments for task delegation
  • Compute marketplace — pay per inference
  • Data oracle micropayments on demand
  • Multi-agent task bounties and coordination

Any HTTP endpoint becomes monetizable in 10 lines of code — no new infrastructure required.
Full Example
Paid Community API in Practice
import { createX402Server } from "@perkos/x402";

const app = createX402Server({
  wallet: SERVER_WALLET,
  network: "base",
  token: "USDC"
});

// Free endpoint
app.get("/health", (req, res) =>
  res.json({ ok: true })
);

// $0.001 per call — community market data
app.get("/api/markets", x402("0.001"),
  async (req, res) => {
    const data = await getMarketData();
    res.json(data);
});

// $0.01 per call — premium analytics
app.get("/api/analytics", x402("0.01"),
  async (req, res) => {
    const report = await generateReport(req.query);
    res.json(report);
});

app.listen(3000);
Design Principles
Granular Pricing
Different endpoints carry different prices. Free health checks co-exist with paid premium routes — all on the same server instance.
Zero Boilerplate
The x402() wrapper handles the entire challenge-verify-settle lifecycle. Drop it onto any Express route in seconds.
Per-Call Revenue
No subscriptions, no invoicing. Revenue lands in SERVER_WALLET on-chain with every successful request.
Why Base + USDC
<1¢
Gas per tx
Base L2 makes sub-cent transactions economically viable at any scale
~1s
Settlement finality
Near-instant confirmation means agents don't wait — they transact in real time
16
Chains supported
Deploy once, collect payments across 16 EVM-compatible networks
USDC + EIP-3009
USDC natively implements EIP-3009, enabling gasless off-chain signatures that the server redeems on-chain. The payer never touches gas — only the settling server does, and only once per request.
Multi-Chain Ready
While Base is the recommended default for its speed and Coinbase ecosystem integration, x402 works seamlessly on Celo, Arbitrum, Optimism, Polygon, and 12 more EVM networks — meeting your community where they are.
Infrastructure
PerkOS Stack: x402 Infrastructure
What We Built
Facilitator
Hosted verify-and-settle API — no need to run your own settlement node. Call our endpoint, get a result.
Agent Identity
On-chain agent profiles via ERC-8004 — discoverable, verifiable identities for autonomous actors.
A2A Protocol
Agent-to-agent coordination layer — structured task delegation and payment between autonomous agents.
Multi-Chain
Unified API across 16 EVM networks — one integration, universal reach.
Live Now 🟢
01
stack.perkos.xyz
Facilitator API live and accepting requests — verify and settle x402 payments instantly
02
5 Autonomous Agents
Running in production today, transacting with x402 on Base mainnet
03
Open Source
Full SDK and infrastructure code available on GitHub — fork, extend, contribute
Start Building Today
Github.com/JulioMCruz/x402-Demo
🌐 perkos.xyz
Main hub for x402 infrastructure, documentation, and getting started guides. Everything you need to monetize your first endpoint.
stack.perkos.xyz
Live facilitator API — drop in verify-and-settle without running your own node. Production-ready, multi-chain.
🐙 github.com/PerkOS-xyz
Full open-source SDK. Audit the code, extend the protocol, contribute back to the community.
Any HTTP endpoint. Any community. 10 lines of code. Micropayments for everyone.
Julio M. Cruz · @perk_os · @juliomcruz