# Which x402 SDK or library should I use?

> Use the official SDK for your language where one exists. JavaScript and TypeScript use the @x402 packages on npm, Python uses the x402 package on PyPI, and Go uses the module in the x402 repository. Rust, Ruby, Java and Elixir have community libraries. Older un-scoped npm packages such as x402-express are version 1 and are legacy.

## Official SDKs

| Language | Package | Covers |
|---|---|---|
| JavaScript, TypeScript | `@x402/*` on npm | Clients, server middleware, facilitator, many networks |
| Python | `x402` on PyPI | FastAPI and Flask servers, httpx and requests clients |
| Go | `github.com/x402-foundation/x402/go/v2` | Client, server and facilitator |

All three are developed in the x402 Foundation's repository and released often.

## The JavaScript packages, by job

| You want to | Install |
|---|---|
| Pay from `fetch` | `@x402/fetch` |
| Pay from Axios | `@x402/axios` |
| Charge in Express | `@x402/express` |
| Charge in Next.js | `@x402/next` |
| Charge in Hono | `@x402/hono` |
| Charge in Fastify | `@x402/fastify` |
| Show a payment page to people in a browser | `@x402/paywall` |
| Use x402 inside MCP | `@x402/mcp` |
| Add the Bazaar listing and other extensions | `@x402/extensions` |

Each also needs `@x402/core` and one package per network family: `@x402/evm` for Ethereum-style chains, `@x402/svm` for Solana, and others for Algorand, Aptos, Stellar and more.

## Community libraries

| Language | Library | Notes |
|---|---|---|
| Rust | `x402-rs` (`x402-axum`, `x402-reqwest`) | Listed in the official third-party SDK page. Includes a self-hostable facilitator |
| Ruby | `x402-rails` | Rails paywall helper from Quicknode |
| Java | Mogami `x402-java-client` and Spring Boot starter | Third-party. The x402 repository has a Java module, but we could not confirm a published release |
| Elixir | `raxol_payments` | x402 and MPP client with spend limits |

There is no official Rust SDK.

## Version 1 packages are legacy

Before version 2, the npm packages were un-scoped: `x402`, `x402-express`, `x402-axios`, `x402-fetch`, `x402-hono`, `x402-next`. Tutorials from 2025 use them. For new work use the `@x402/*` scope, which supports version 2 and can still read version 1. See [version 1 and version 2 compared](https://www.ask402.ai/x402/x402-v1-vs-v2).

## Not every SDK supports every feature

The schemes beyond `exact` are unevenly supported. `auth-capture`, for example, is only in the TypeScript and Go SDKs. If you need `upto` or `batch-settlement`, check the SDK feature table in the official documentation before choosing a language.

## Libraries that cover more than x402

Some tools speak x402 and MPP both, which helps if you buy from sellers on either: Faremeter, the Solana Foundation's `pay` command-line tool, and platform SDKs from Cloudflare and thirdweb.

The [SDK directory](https://www.ask402.ai/directory/sdks) lists these with links.

## Sources

- [x402 repository](https://github.com/x402-foundation/x402)
- [Third-party SDKs, x402 documentation](https://docs.x402.org/dev-tools/third-party-sdks)
- [SDK feature support, x402 documentation](https://docs.x402.org/sdk-features)
- [x402 on PyPI](https://pypi.org/project/x402/)

---

Facts checked against the sources above on 2026-11-20. Canonical page: https://www.ask402.ai/x402/x402-sdks
