Paymentsx402 Foundation

x402 SDKs

Open-source TypeScript, Python and Go SDKs for charging and paying per request over HTTP 402

x402 is an open standard for internet-native payments built on the HTTP 402 Payment Required status code. A resource server answers a request with the payment it requires; the client sends a signed payment payload; the server verifies it, either locally or through a facilitator, and settles it. The reference SDKs live in the x402 Foundation's GitHub repository: TypeScript packages on npm under @x402 (core, chain packages, client wrappers for fetch and axios, and server middleware for Express, Fastify, Hono and Next), a Python package (x402 on PyPI) and a Go module. Version state as of 21 October 2026: the latest npm releases of the @x402 packages are 2.28.0 (29 September 2026), the Go module is v2.28.0, and the Python package is 2.25.0 (29 September 2026). A fix merged on 13 October 2026 (pull request #3796) closes a payment bypass where HEAD requests could reach paid GET handlers without payment verification, in the TypeScript, Go and Python route matchers; no published release includes it yet. The unscoped npm package named x402 is the older version 1 line and is still at 1.2.0 (16 April 2026); install the scoped @x402 packages for version 2.

Use Cases

  • Charge other agents per request for an API or MCP tool
  • Let an agent pay per call for data, model inference or compute without an account at each provider
  • Add payment middleware to an Express, Fastify, Hono or Next server
  • Wrap fetch or axios so an agent client handles 402 responses

Key Features

HTTP-native payments

Uses the 402 Payment Required status code; the server states what payment it accepts and the client returns a signed payment payload.

Facilitator model

Servers can verify and settle payments themselves or through a facilitator's verify and settle endpoints.

Multi-language SDKs

TypeScript packages on npm under @x402, a Python package on PyPI and a Go module, maintained in one repository.

Network-agnostic design

Chain support ships as separate packages; the project says it aims to support crypto and fiat networks.

Published version state

npm @x402 packages 2.28.0, Go v2.28.0 and PyPI 2.25.0 as of 21 October 2026; the 13 October HEAD-request fix is merged but unreleased. The unscoped npm package x402 is still at 1.2.0.

Integrations

ExpressFastifyHonoNext.jsFetchAxiosFlask