T402 Documentation

v2.8.0 Latest
50 Networks
11 Chains
38 Packages

The open payment protocol for USDT — enable seamless stablecoin payments across 11 blockchain families with a single HTTP header.


Why T402?

HTTP Native

Pay for any HTTP resource with a single header. No payment forms, no redirects, no SDKs required on the client.

Multi-Chain

11 blockchain families: EVM, Solana, TON, TRON, NEAR, Aptos, Tezos, Polkadot, Stacks, Cosmos.

Gasless Payments

ERC-4337 account abstraction lets users pay without holding native tokens for gas fees.

AI Ready

MCP server enables AI agents to discover and pay for APIs autonomously via Model Context Protocol.


Quick Start

pnpm add @t402/core @t402/evm @t402/fetch
import { t402Client, wrapFetchWithPayment } from '@t402/fetch'
import { registerExactEvmScheme } from '@t402/evm/exact/client'
 
const client = new t402Client()
registerExactEvmScheme(client, { signer })
 
// Payments handled automatically on 402
const response = await wrapFetchWithPayment(fetch, client)(
  'https://api.example.com/premium'
)

How It Works

Client makes request

GET /api/premium HTTP/1.1
Host: api.example.com

Server returns 402 Payment Required

HTTP/1.1 402 Payment Required
Payment-Required: scheme="exact";network="eip155:8453";amount="10000";...

Client signs and retries

GET /api/premium HTTP/1.1
Payment-Signature: signature="0x...";payload="..."

Server verifies and responds

HTTP/1.1 200 OK
Content-Type: application/json
{"data": "Premium content!"}

SDKs


Supported Networks

See Chains for network IDs, token addresses, and configuration details.


Use Cases

Use CaseDescriptionPrice Range
AI Agent PaymentsAI agents pay for APIs via MCP$0.001 - $0.10/call
API MonetizationCharge per-request for endpoints$0.01 - $1.00/req
Premium ContentGate content behind micro-payments$0.10 - $10.00/item
Micro-PaymentsSub-cent payments on L2 networks$0.0001 - $0.01/tx

Packages

Core & Blockchain@t402/core · @t402/evm · @t402/svm · @t402/ton · @t402/tron · @t402/near · @t402/aptos · @t402/tezos · @t402/polkadot · @t402/stacks · @t402/cosmos · @t402/btc · @t402/stellar · @t402/erc8004

WDK Integration@t402/wdk · @t402/wdk-protocol · @t402/wdk-gasless · @t402/wdk-bridge · @t402/wdk-multisig

HTTP Server@t402/express · @t402/next · @t402/hono · @t402/fastify

HTTP Client@t402/fetch · @t402/axios

UI & Tools@t402/paywall · @t402/react · @t402/vue · @t402/mcp · @t402/cli


Get Started