Skip to main content
x402 is an internet-native payments protocol that enables agents to send and receive payments for services. This helps developers build autonomous agents and agentic applications directly on SKALE. This guide covers the essential concepts for building agents that interact with x402 payments.

What is x402?

x402 is a payment protocol that extends HTTP with native payment capabilities using the 402 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 TransferWithAuthorization for 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 onchain
  • /settle - Executes the onchain payment settlement
Facilitators generally support a 3rd endpoint — /supported — which allows agents to discover resources.
Learn More: Run a Facilitator

2. Payment Middleware

Middleware that protects HTTP endpoints by enforcing the x402 payment handshake:
  • Returns 402 Payment Required when 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.
Learn More: Accept Payments

3. Payment Client

Client libraries that handle the x402 payment flow automatically:
  • Detect 402 Payment Required responses
  • Create and sign payment authorizations
  • Retry requests with proper payment headers
Learn More: Make Payments

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:

Resources