Understanding
HTTP 402 Payment Required

A standard protocol for crypto-native payments on the web.

What is x402?

HTTP 402 is a standard status code reserved for "Payment Required" since 1997.

x402 brings this vision to life using blockchain technology and cryptographic signatures.

It enables gasless, instant crypto payments for digital content and services.

The Protocol Flow

Client
→ GET /premium-content
Server
← 402 Payment Required
Client
→ Sign payment (EIP-712)
Facilitator
→ Verify & settle on-chain
Server
← 200 OK + content

The Facilitator

The facilitator is a backend service that bridges users and merchants.

It verifies payment signatures off-chain and settles transactions on-chain.

This architecture enables gasless payments - users only sign, never pay gas.

Dual Token Support

Our facilitator supports both ERC-20 and EIP-3009 tokens:

EIP-3009 Tokens

Native support for gasless transfers (e.g., USDC on some chains)

  • • Direct transferWithAuthorization
  • • Built-in signature verification
  • • No wrapper needed

Standard ERC-20

Via ERC20AdapterSecure contract wrapper

  • • Adds EIP-3009 functionality
  • • EIP-712 signature support
  • • Works with any ERC-20

Facilitator Endpoints

  • POST /api/verify - Validates payment signatures off-chain
  • POST /api/settle - Executes on-chain settlement
  • • Manages gas wallet for transactions
  • • Supports multiple token types automatically

ERC20AdapterSecure Contract

For standard ERC-20 tokens without native gasless support, we use an adapter contract.

This contract wraps any ERC-20 token and adds EIP-3009 functionality.

Users approve the adapter once, then can make gasless payments via signatures.

Key Features

  • EIP-712 Typed Data - Structured, readable signatures
  • Nonce Management - Prevents replay attacks
  • Time-Bound Auth - validAfter/validBefore timestamps
  • SafeERC20 - Handles non-standard token implementations

Payment Signature Example

// User signs this message (no gas required)
const signature = await wallet.signTypedData({
  domain: {
    name: 'ERC20AdapterSecure',
    version: '1',
    chainId: 19191,
    verifyingContract: adapterAddress
  },
  types: {
    TransferWithAuthorization: [
      { name: 'token', type: 'address' },
      { name: 'from', type: 'address' },
      { name: 'to', type: 'address' },
      { name: 'value', type: 'uint256' },
      { name: 'validAfter', type: 'uint256' },
      { name: 'validBefore', type: 'uint256' },
      { name: 'nonce', type: 'bytes32' }
    ]
  },
  message: {
    token: usdcAddress,
    from: userAddress,
    to: merchantAddress,
    value: 1000000, // 1 USDC (6 decimals)
    validAfter: Math.floor(Date.now() / 1000),
    validBefore: Math.floor(Date.now() / 1000) + 300, // 5 min
    nonce: randomBytes32()
  }
});

// Facilitator verifies and settles on-chain

Why x402?

For Users
  • • Zero gas fees
  • • Just sign, don't transact
  • • Instant payments
  • • Works with any wallet
For Merchants
  • • Standard HTTP protocol
  • • Easy integration
  • • Guaranteed settlement
  • • No blockchain expertise needed
For Ecosystem
  • • Chain-agnostic design
  • • Supports any ERC-20
  • • Open protocol
  • • Better UX drives adoption

See it in action

Try Interactive Demo →