All articles
solanax402paymentsai-agentsusdc

PayAI: the x402 facilitator on Solana

PayAI is the largest x402 facilitator after Coinbase. Here's the facilitator role in the x402 spec, the gasless settlement flow on Solana, and how to wire it into a merchant or client in one line.

If you've read the x402 article, you know the wire flow: a server answers 402 Payment Required, the client pays on-chain, the server verifies and serves the content. But that spec leaves one role unfilled — who actually verifies the payment and settles it on-chain? That's the facilitator, and PayAI runs the largest one after Coinbase.

A facilitator is the piece that lets a merchant accept x402 payments without ever touching an RPC node or a wallet. This piece is a Solana-first walk through what PayAI's facilitator does, the gasless settlement model, and how little code it takes to wire up.

What a facilitator is in x402

The x402 spec deliberately splits the merchant (the resource server serving paid content) from the party that talks to the chain (the facilitator). The resource server never needs an RPC connection, a wallet, or chain-specific code. It delegates two jobs:

  • POST /verify — "is this payment payload valid for this requirement?" (signature, amount, asset, recipient, nonce, expiry). Returns a yes/no without touching the chain's mempool.
  • POST /settle — "broadcast and confirm it." The facilitator submits the transaction and reports the on-chain result.

A GET /supported endpoint advertises which (network, scheme, asset) tuples the facilitator handles. PayAI's lives at https://facilitator.payai.network.

The PayAI twist: gasless for both sides

The notable design choice is that neither the buyer nor the merchant pays network fees. PayAI's facilitator fronts the gas, handles verification and settlement, and abstracts the chain away entirely. On Solana this is natural — the facilitator can act as the fee payer on a transaction the buyer signs, so the buyer never needs SOL in their wallet, only the stablecoin they're spending.

text
Buyer signs:    a USDC transfer (no SOL needed for fees)
Facilitator:    sets itself as feePayer, co-signs, broadcasts
Merchant:       gets paid, never saw an RPC endpoint
Both sides:     pay zero network gas

Networks and assets

PayAI is Solana-first but multi-network. The facilitator currently advertises:

  • Solanasolana, solana-devnet
  • EVM — Base, Polygon, Avalanche, Arbitrum (plus their testnets), SKALE, Sei, XLayer, Peaq, IoTeX, and KiteAI

Pricing is per-endpoint, denominated in fiat or atomic units, settled in stablecoins (or a merchant's own token). By transaction volume PayAI has handled roughly 13–14% of all x402 traffic — second only to Coinbase's facilitator.

Merchant integration

For the resource server, integration is one env var plus middleware. The middleware intercepts unpaid requests, returns the 402 with the requirement, and on retry calls the facilitator's /verify and /settle for you.

typescript
import express from "express"
import { paymentMiddleware } from "x402-express"

const app = express()

app.use(
  paymentMiddleware(
    "<merchant-solana-address>",          // payTo
    {
      "GET /premium": {
        price: "$0.01",                    // fiat — facilitator resolves to USDC atomic units
        network: "solana",
      },
    },
    { url: "https://facilitator.payai.network" }, // the only PayAI-specific line
  ),
)

app.get("/premium", (_req, res) => {
  res.json({ data: "the paid content" })
})

app.listen(3000)

Same shape for Hono with x402-hono. The merchant code never imports @solana/web3.js — that lives inside the facilitator.

Client / agent payments

On the buyer side, the x402 client wraps your HTTP library, catches the 402, builds and signs the payment, and retries — invisibly.

typescript
import { withPaymentInterceptor } from "x402-axios"
import axios from "axios"
import { Keypair } from "@solana/web3.js"

const wallet = Keypair.fromSecretKey(/* agent's key */)

const client = withPaymentInterceptor(
  axios.create({ baseURL: "https://api.example.com" }),
  wallet,                       // signs the payment when a 402 comes back
)

// Looks like a normal request — the 402 → pay → retry happens inside:
const { data } = await client.get("/premium")

Because the signing wallet is just a keypair, this is exactly what an autonomous agent needs: it can pay any x402 endpoint on the open internet with no API key, no signup, no human in the loop.

The honest read

The gasless facilitator model is a real convenience but it's also a trust and centralization point: the facilitator sees every payment, fronts the gas (so it has a cost model to recoup), and is a single service the merchant depends on for settlement. That's the opposite end of the spectrum from running your own verification against an RPC node. For low-stakes, high-volume, agent-driven calls the trade-off is clearly worth it; for high-value settlement you'd want to verify on-chain yourself.

References

x402 gave Solana a payment standard. A facilitator is what turns that standard into something a merchant can ship in one line — and PayAI runs the largest one on Solana today.

PayAI: the x402 facilitator on Solana | devrels.xyz