What is x402?
x402 is a payment protocol that extends HTTP with native payment capabilities using the402 Payment Required status code. It enables:
- Paywalled Resources: Protect APIs and services behind payments
- Autonomous Payments: Agents can automatically pay for and access resources
- ERC-3009 Compatibility: Uses
TransferWithAuthorizationfor gasless payments - Multi-Token Support: Accept payments in various ERC-20 tokens
Core Components
1. Facilitator
A facilitator processes x402 payments by exposing endpoints that verify and settle payment authorizations:/verify- Validates payment signatures without executing on-chain/settle- Executes the on-chain payment settlement
Facilitators generally support a 3rd endpoint —
/supported — which allows agents to discover resources.2. Payment Middleware
Middleware that protects HTTP endpoints by enforcing the x402 payment handshake:- Returns
402 Payment Requiredwhen payment is missing - Forwards payment to facilitator for verification
- Allows request to proceed after successful settlement
The middleware is implemented at the seller/merchant level and is able to be fully stateless. This is done through the use of a 3rd party facilitator who handles the above verification and settlement on your behalf.
3. Payment Client
Client libraries that handle the x402 payment flow automatically:- Detect
402 Payment Requiredresponses - Create and sign payment authorizations
- Retry requests with proper payment headers
Quick Start: Build a Payment-Enabled Agent
Here’s a minimal example of an agent that can access paywalled resources:Use Cases
Autonomous Service Access
Build agents that pay for API calls, data feeds, or AI services:Monetize Agent Services
Create services where agents pay to access your AI models or data:Multi-Agent Economies
Enable agents to pay each other for services in a decentralized economy:Payment Tokens on SKALE
SKALE Base Sepolia Testnet supports various tokens for x402 payments:| Token | Address | Decimals |
|---|---|---|
| Axios USD | 0x61a26022927096f444994dA1e53F0FD9487EAfcf | 6 |
| Bridged USDC | 0x2e08028E3C4c2356572E096d8EF835cD5C6030bD | 6 |
Next Steps
Build an Agent
Create autonomous agents that handle x402 payments
Accept Payments
Protect your APIs with x402 payment middleware
Make Payments
Implement payment client for accessing paywalled resources
Run a Facilitator
Set up your own payment processing service
