x402-sdk

TypeScript SDK for the x402 HTTP payment protocol — add crypto payments to any API.

GitHub: fastxyz/fast-sdkarrow-up-right

What You Can Do

  • Pay-per-request APIs — charge for individual API calls using HTTP 402

  • No accounts needed — just sign and pay

  • Multi-chain — Fast (instant), Arbitrum, Base, Ethereum

Installation

npm install @fastxyz/x402-client @fastxyz/x402-server @fastxyz/x402-facilitator

Packages

Package
Description
GitHub

@fastxyz/x402-client

Sign and pay for 402 content

@fastxyz/x402-server

Protect routes, verify payments

@fastxyz/x402-facilitator

Verify signatures, settle on-chain

How It Works

The x402 protocol is HTTP-native. On the server side, you add payment middleware to your routes — unprotected requests receive a 402 Payment Required response with payment details. On the client side, the SDK handles the full flow: receive the 402, sign a payment, attach proof, and retry — all in one call.

For complete setup instructions, runnable code examples for both server and client, and protocol details, see the individual package READMEs linked above or the Fast SDK monorepo on GitHubarrow-up-right.

Last updated

Was this helpful?