Dexter
Dexter
Docs

What is x402?

x402 is an HTTP payment protocol that enables any client to pay any server for access to resources - no API keys, no subscriptions, no signup required.

The name comes from HTTP 402 Payment Required - a status code that was reserved in HTTP/1.1 but never standardized. x402 finally gives it meaning.

How It Works

sequenceDiagram
    participant Client
    participant Server
    participant Facilitator
    participant Chain
 
    Client->>Server: GET /api/resource
    Server-->>Client: 402 + payment requirements JSON
    Client->>Client: Build tx, sign with wallet
    Client->>Server: GET /api/resource + X-PAYMENT header
    Server->>Facilitator: POST /settle
    Facilitator->>Chain: Submit + confirm
    Facilitator-->>Server: Settlement proof
    Server-->>Client: 200 OK + response data

1. Client requests a resource

GET /api/some-paid-endpoint HTTP/1.1
Host: example.com

2. Server responds with payment requirements

HTTP/1.1 402 Payment Required
Content-Type: application/json
 
{
  "x402Version": 2,
  "accepts": [{
    "scheme": "exact",
    "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amount": "10000",
    "payTo": "SELLER_WALLET_ADDRESS",
    "maxTimeoutSeconds": 60,
    "extra": {
      "feePayer": "FACILITATOR_FEE_PAYER_ADDRESS"
    }
  }]
}

The accepts array lists every chain/asset pair the seller will take. The client picks the one it can pay on.

3. Client builds and signs payment

The client constructs a USDC transfer transaction matching the requirements, signs it with the buyer's wallet, and base64-encodes the result.

4. Client retries with payment header

GET /api/some-paid-endpoint HTTP/1.1
Host: example.com
X-PAYMENT: <base64-encoded-payment-payload>

5. Server settles through the facilitator

The server forwards the payment to the facilitator, which verifies policy compliance, sponsors fees (on Solana), and submits the transaction on-chain. Once confirmed, the server returns the data.

Why x402?

vs. API Keys

FeatureAPI Keysx402
Signup requiredYesNo
Email verificationYesNo
Rate limitsComplex tiersPay for what you use
BillingMonthly invoicesInstant, per-request
AI agent friendlyNoYes

vs. Traditional Payments

FeatureStripe/PayPalx402
Minimum transaction~$0.30 fee floorFractions of a cent
Settlement time2-7 daysSeconds
ChargebacksRiskImpossible
Global accessVaries by countryPermissionless

The Role of the Facilitator

The Facilitator is the middleware that makes x402 practical:

  1. Verifies payments - Checks transaction validity and policy compliance
  2. Sponsors fees - Pays transaction fees so buyers don't need native tokens
  3. Settles on-chain - Signs and broadcasts transactions to the blockchain

Dexter operates the most-used x402 facilitator, settling payments across Solana, Base, Polygon, Arbitrum, Optimism, Avalanche, and SKALE.

Learn more about the Facilitator →

Resources