TransX402 Docs

What is x402?

A complete explanation of the x402 protocol — how HTTP 402 enables automatic stablecoin payments directly on the web.

At a glance

  • The server responds to a request with HTTP 402 Payment Required and machine-readable payment terms
  • The buyer's wallet signs a payment authorization — no gas required
  • A facilitator (like TransX402) verifies the signature and submits the transaction on-chain

Background

The HTTP status code 402 Payment Required has existed since the original HTTP/1.1 specification in 1997, but was never widely used — until now. x402 is an open payment protocol developed by Coinbase and supported by Cloudflare that finally puts it to work: it embeds machine-readable payment instructions into standard HTTP responses, enabling instant, automatic stablecoin payments directly on the web.

How a Payment Works

Client sends a request. A client (browser, app, or AI agent) sends a standard HTTP request, for example to access a premium article:

GET /article/premium-content HTTP/1.1
Host: example.com

Server responds with 402. If the content requires payment, the server responds with payment details in JSON:

{
  "x402Version": 1,
  "accepts": [{
    "scheme": "permit2",
    "network": "base",
    "token": "0x18Bc5bcC660cf2B9cE3cd51a404aFe1a0cBD3C22",
    "maxAmountRequired": "5000000000000000000000",
    "resource": "https://example.com/article/premium-content"
  }]
}

Client signs a payment authorization. The buyer signs a gasless cryptographic authorization — no ETH required. For Permit2 tokens like IDRX, a one-time approval is needed first; every payment after that is signature-only. The signed payload is sent to the facilitator for verification.

Facilitator verifies and submits on-chain. TransX402 verifies the signature, checks the payer's balance, simulates the transaction, and submits it to the blockchain — paying the gas itself.

Blockchain confirms the transaction. The on-chain settlement completes and the facilitator receives confirmation that the payment succeeded.

Facilitator notifies the server. Once settled, the facilitator tells the server the payment is valid so it can release the protected content.

Server delivers the content. The server returns a normal 200 OK with the requested content (and an X-PAYMENT-RESPONSE header when applicable).

Authorization Methods

x402 supports several payment authorization methods. IDRX uses Permit2, since it's a standard ERC-20 token without native EIP-3009 support.

MethodTokensNotes
EIP-3009USDC, EURCNative gasless transfer — simplest approach
Permit2All ERC-20 (including IDRX)One-time approval to the Permit2 contract
ERC-7710Smart contract walletsFor smart contract wallets

Why Are Transaction Fees So Low?

Fees stay under $0.003 per transaction because of three things working together: cheap L2 settlement, free off-chain signing, and one optimized transaction paid for by the facilitator.

  • L2 settlement — Payments settle on low-cost chains like Base, not Ethereum mainnet, where gas is a fraction of a cent instead of dollars.
  • Off-chain authorization — The buyer's Permit2 or EIP-3009 signature is free; no gas is spent until the final settlement transaction hits the chain.
  • Facilitator pays gas — TransX402 submits one optimized transaction per payment and covers the gas itself, so the buyer never needs ETH.
  • No card-rail overhead — There's no interchange fee, acquirer margin, or cross-border FX layer; value moves directly from buyer wallet to merchant wallet as stablecoin.

Because the fixed cost per transaction is tiny on Base, charging Rp 5,000 for a single article is economically viable — see What is IDRX? for why TransX402 defaults to Base.

Why x402 Matters

  • Open standard — anyone can build a compatible client, server, or facilitator
  • No buyer registration — buyers just need a crypto wallet, no account required
  • Gasless for payers — the facilitator covers gas fees
  • AI agent compatible — agents can pay for content automatically without human intervention
  • Micropayment-friendly — see above for why fees stay low enough for small payments

Ecosystem

x402 is backed by a rapidly growing ecosystem: Coinbase is the primary protocol developer providing official SDKs and the CDP facilitator; Cloudflare integrates it via Agents SDK and MCP Servers; and the two co-founded the x402 Foundation to drive adoption. The protocol processed 75+ million transactions in the 30 days leading up to March 2026.

PackageLanguagePurpose
@x402/fetchTypeScriptClient — Fetch API wrapper
@x402/express, @x402/hono, @x402/nextTypeScriptServer middleware
x402PythonClient and server support

See the official x402 docs for the complete SDK list.

TransX402's Role

Coinbase's CDP facilitator only supports USDC. TransX402 is an x402 facilitator built specifically for IDRX, and it's fully compatible with the wider ecosystem — any x402 client library can be pointed at the TransX402 facilitator. Ready to try it? Head to the Quickstart.

On this page