Overview
Integrate Snack Money payments using thirdweb’s x402 fetch wrapper, which handles payment negotiation through thirdweb’s managed infrastructure.Features
- ✅ Base network support
- ✅ Managed infrastructure - thirdweb handles x402 flow
- ✅ x402 wrapper via API - Automatic payment negotiation
- ✅ Server-side wallet - Secure key management
- ✅ thirdweb ecosystem - Works with other thirdweb tools
Prerequisites
- Node.js 18+
- thirdweb account (Sign up)
- thirdweb Secret Key
- thirdweb server wallet with USDC balance on Base
Installation
Quick Start
1. Get thirdweb Credentials
- Visit thirdweb Dashboard
- Create a new project
- Get your Client ID and Secret Key
- Create a wallet and fund with USDC
2. Set Up Environment
Create a.env file:
Important: The
WALLET_ADDRESS should be your thirdweb server wallet address that has USDC on Base network.3. Implement Payment
Createbase-send.ts:
4. Run the Example
Expected Output
How It Works
- Initialize thirdweb: Create client with API credentials
- Create Wallet: Load wallet from private key
- Convert Account: Convert to viem format for x402
- Wrap Axios: Add payment interceptor
- Send Payment: Make payment request
Why thirdweb?
Benefits
- Managed Infrastructure: thirdweb handles blockchain complexity
- Ecosystem Integration: Works with other thirdweb services
- Developer Experience: Simple, consistent APIs
- Multi-Chain Support: Easy to extend to other chains
Best For
- Apps already using thirdweb
- Need thirdweb ecosystem features
- Want managed infrastructure
- Building multi-chain apps
Supported Platforms
thirdweb Features
Using thirdweb Wallets
Smart Wallets
Error Handling
Full Example Repository
View on GitHub → Includes:- Complete implementation
- thirdweb configuration
- Environment setup
- Detailed README
Next Steps
- Try Crossmint - Smart wallet features
- thirdweb Docs - Learn more about thirdweb
- API Reference - Complete API docs