x402 SDKs

Official and community SDKs that implement the x402 client and server flows. Pick the language you ship in, install the package, and start accepting or sending payments with a handful of lines.

TypeScript / Node.js

x402-axios

npm install x402-axios
import axios from 'axios';
import { withPayment } from 'x402-axios';
const client = withPayment(axios.create(), { signer });
const res = await client.get('https://api.example.com/paid');

View repo →

TypeScript / Next.js

x402-next

npm install x402-next
// app/api/paid/route.ts
import { withPayment } from 'x402-next';
export const GET = withPayment(handler, { amount: '0.01' });

View repo →

Python

x402

pip install x402
from x402 import Client
client = Client(signer=signer)
res = client.get('https://api.example.com/paid')

View repo →

Go

go-x402

go get github.com/coinbase/x402/go
client := x402.NewClient(signer)
res, _ := client.Get("https://api.example.com/paid")

View repo →

Rust

x402-rs (community)

cargo add x402
let client = X402Client::new(signer);
let res = client.get("https://api.example.com/paid").await?;

View repo →

Get these stories as a short daily email.

One email each morning. Free. Unsubscribe anytime.