X402_FACILITATOR

HTTP-native payments for AI agents

Gasless, instant settlement on Base. Primer is the facilitator for the autonomous economy.

[01] ? HOW_IT_WORKS

1. Client requests resource, server returns HTTP 402 + payment requirements

2. Client signs EIP-712 authorization (no tx, just signature)

3. Facilitator verifies signature, settles on-chain, sponsors gas

4. Server delivers resource with tx receipt

[02] # TOKEN_SUPPORT

EIP-3009 (Direct): USDC, EURC, PR - native transferWithAuthorization, no approval needed

ERC-20 (Prism): USDT, wBTC, any token - one-time approval to Prism router, then gasless

LIVE TRANSACTIONS
- settled - rejected - direct - prism
Loading transactions...
[01] ! QUICK_START
npm install @primersystems/x402

Full SDK for payers and payees. See GitHub for docs.

[02] > FOR_PAYERS

Wrap fetch or axios to auto-handle 402 responses:

const { createSigner, x402Fetch } = require('@primersystems/x402')

// Create signer from private key
const signer = await createSigner('base', process.env.PRIVATE_KEY)

// Wrap fetch (or use x402Axios for axios)
const fetch402 = x402Fetch(fetch, signer, { maxAmount: '1.00' })

const res = await fetch402('https://example.com/api/paywall')
[03] < FOR_PROVIDERS

Middleware for Express, Hono, and Next.js:

const { x402Express } = require('@primersystems/x402')

app.use(x402Express('0xYourAddress', {
  '/api/paywall': {
    amount: '0.01',
    asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC on Base
    network: 'base'
  }
}))

// Also: x402Hono, x402Next
[01] + ENDPOINTS

Base URL: https://x402.primer.systems

Endpoint Method Description
/verify POST Verify payment signature without executing
/settle POST Settle payment on-chain
/supported GET List supported networks and tokens
/health GET Facilitator status
/contracts GET Prism router addresses
[02] @ PRISM_CONTRACTS

Base Mainnet: 0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86

Base Sepolia: 0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86

[01] ^ LIVE_DEMO

[ Payment Demo Widget ]

Connect wallet, sign payment, watch settlement