Skip to main content

What is x402?

x402 is a payment protocol that uses the HTTP 402 Payment Required status code to enable machine-to-machine payments. When an agent hits a paywalled endpoint, the server responds with payment requirements; the agent’s wallet signs a USDC payment, and the request is retried with the payment proof attached. This gives AI agents a payment rail that works like an API call — no card forms, no browser sessions, no human in the loop.

How It Works

Payment Requirements

The 402 response includes everything the agent needs to construct a payment:

Payment Execution

The agent signs a USDC payment using its wallet and includes the proof in the X-PAYMENT header:

Three Use Cases

1. Companion Order Payments

The most common flow: agents create a companion order and pay for it via x402. The concierge model means the user pays Podium in USDC, and Podium handles purchasing from the retailer and shipping.
The Conversational Agent automates this entire flow during chat — the agent’s create_order tool creates the companion order and the initiate_order tool guides the user through providing shipping details.

2. Standard Commerce Payments

For orders in Podium’s core commerce system (not companion orders), x402 works the same way:

3. Pay-Per-Call API Access

Podium’s x402 middleware can gate any endpoint behind a crypto paywall. Agents pay per-request in USDC to access premium data or services:
The x402 middleware is configured per-endpoint in the Podium API. When enabled, it intercepts requests before the route handler and requires a valid payment proof.

Wallet Options

Privy Server Wallets (Automated)

For bots and backend agents that need to pay without user interaction:

Privy Embedded Wallets (User-Controlled)

For consumer-facing apps where the user funds and controls the wallet:

USDC on Base

All x402 payments settle in USDC on Base L2: The facilitator at https://facilitator.x402.org (Coinbase) handles payment verification and settlement.

Payment States

Graceful Fallback

When x402 payment fails (insufficient balance, network issues, wallet not configured), applications should fall back gracefully:
The Beauty Companion reference implementation demonstrates this pattern — it awards 25 points for successful x402 purchases and 10 points for purchase intents where payment failed.