The first Cardano payment facilitator on mainnet. Request a resource, get a 402, pay with ADA, access granted.
The full x402 payment cycle — from request to on-chain settlement — runs through seven discrete steps. No accounts, no API keys, no billing.
Real transactions, verified on-chain. Tested end-to-end on Preview testnet, now live on Cardano mainnet — processing real ADA payments through the full x402 verify → settle pipeline.
Before any transaction touches the blockchain, it passes through a 10-check verification pipeline. All checks run — even after the first failure — so clients get a complete list of issues.
Five attack vectors tested against the live facilitator on Preview testnet. All rejected with specific, actionable error codes.
invalid_cbor
Transaction CBOR could not be parsed
recipient_mismatch
No output pays to the required recipient
amount_insufficient
Payment amount is less than required
transaction_expired
Transaction TTL has expired
idempotent_return
Same txHash returned without re-submission
The facilitator never holds private keys. It verifies client-signed transactions and submits them to the blockchain. Your keys stay in your wallet.
The SDK gives any Fastify resource server x402 payment gating. Wrap any route — the middleware handles 402 responses, verification, and settlement automatically.
import { FacilitatorClient, createPaymentGate } from 'x402-fac/sdk'; // Connect to your facilitator const facilitator = new FacilitatorClient({ baseUrl: 'http://localhost:3000' }); // Create a payment gate const gate = createPaymentGate({ facilitator, payTo: 'addr_test1qp...', amount: '2000000', // 2 ADA network: 'cardano:preview', }); // Protect any route app.post('/api/generate', { preHandler: gate }, handler);
// 1. Request resource → get 402 const res = await fetch('/api/generate'); // res.status === 402 // 2. Parse payment requirements const requirements = parsePaymentRequired( res.headers.get('Payment-Required') ); // 3. Build & sign Cardano tx const tx = await lucid .newTx() .pay.ToAddress(requirements.payTo, { lovelace: BigInt(requirements.amount) }) .complete(); const signed = await tx.sign .withWallet().complete(); // 4. Retry with payment → get 200 const paid = await fetch('/api/generate', { headers: { 'Payment-Signature': encodePayment(signed) } }); // paid.status === 200 🎉
Different chains for different price tiers. The x402 protocol is chain-agnostic — Cardano handles operations worth ≥1 ADA (~$0.30), while EVM L2s handle sub-cent transactions.