x402 Mantle SDK Documentation
SDK for gasless x402 payments on Mantle blockchain using USDC (EIP-3009). Protect your APIs with crypto payments — users sign, facilitator pays gas.
Current limitation: The SDK supports only USDC on Mantle Mainnet. This is due to EIP-3009 requirements for gasless payments — USDC is currently the only token on Mantle implementing this standard.
What is x402?
x402 is a payment protocol based on the HTTP 402 "Payment Required" status code. When a client requests a paid resource without payment, the server returns 402 with payment requirements. The client then signs a payment authorization and retries.
Key benefits:
- Gasless for users - Users only sign a message, the facilitator pays gas
- Instant payments - USDC transfers settle in seconds
- Simple integration - Just add middleware to your API routes
- Real-time analytics - Track all payments in your dashboard
How It Works
- Request — Client calls your API without payment
- 402 Response — Server returns payment requirements
- Sign — User signs authorization in wallet (gasless)
- Settle — Client sends authorization to facilitator
- Execute — Facilitator transfers USDC on-chain
- Retry — Client retries request with payment proof
- Verify — Server confirms payment with facilitator
- Content — API returns the response
Quick Links
Getting Started
- Quick Start - Get up and running in 5 minutes
- Installation - Detailed installation guide
SDK Documentation
- Client SDK - React hooks and vanilla JavaScript
- Server SDK - Express, Next.js, Hono, and more
Infrastructure
- Facilitator - Hosted and self-hosted options
- Dashboard - Analytics and API keys
Reference
- API Reference - TypeScript types and endpoints
- Examples - Complete working examples
- FAQ - Common questions and troubleshooting
Resources
- AI Prompt - Integration prompt for AI assistants
Supported Frameworks
Server:
- Express.js
- Next.js (App Router)
- Hono
- Cloudflare Workers
- Deno
- Bun
Client:
- React (hooks)
- Vanilla JavaScript
- Any framework with fetch API
Network Information
| Property | Value |
|---|---|
| Chain | Mantle Mainnet |
| Chain ID | 5000 |
| Currency | USDC |
| USDC Address | 0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9 |
| Decimals | 6 |
Supported Tokens
Currently, the SDK supports USDC only for gasless payments.
Why only USDC?
Gasless payments require tokens that implement EIP-3009 (transferWithAuthorization). This standard allows users to sign payment authorizations off-chain while the facilitator submits transactions and pays gas.
On Mantle mainnet, USDC is the only token implementing EIP-3009. As other tokens adopt this standard, we will add support for them.
| Token | EIP-3009 | Status |
|---|---|---|
| USDC | Yes | Supported |
| USDT | No | Not available |
| DAI | No | Not available |
| Other | — | Pending adoption |