x402 SDK Overview

Add HTTP-native payments to your applications using the x402 protocol. Payers sign authorizations—no gas fees required.

What is x402?

x402 is an open payment standard based around the HTTP 402 status, meaning Payment Required. This is in the same family as 404; Not Found. HTTP status codes were introduced in the 1990's, with 402 being intended for a then-unknown future payment system. In 2025, x402 unlocked this potential, allowing for gasless, instant settlement of agent-to-agent payments of any size.

Primer expands on the basic x402 offering with full ERC-20 support via the Prism router.

Gasless for payers. Payments are authorized via EIP-712 signatures. The facilitator handles gas costs and settlement.

How It Works

x402 payment flow diagram
  1. Client requests a protected resource
  2. Server returns 402 Payment Required with payment details
  3. Client signs a payment authorization (no gas)
  4. Client retries with the signed payment in PAYMENT-SIGNATURE header
  5. Server verifies payment via facilitator and returns the resource

Choose Your SDK

Supported Networks

Networks use CAIP-2 identifiers:

Network CAIP-2 ID Facilitator
Base eip155:8453 Primer ✓
Base Sepolia eip155:84532 Primer ✓
Ethereum eip155:1 Custom required
Arbitrum eip155:42161 Custom required
Optimism eip155:10 Custom required
Polygon eip155:137 Custom required

Token Support

EIP-3009 Tokens (USDC, EURC)

Native gasless transfers via transferWithAuthorization. The payer signs, the facilitator executes—zero gas for the payer.

Standard ERC-20 Tokens

Requires a one-time approval to Primer's Prism contract. After that, payments are gasless via signature authorization.