GitHub Repository
View source code, examples, and contribute
npm Package
Install @b3dotfun/anyspend-x402 package
What is AnySpend x402?
AnySpend x402 is B3’s implementation of the x402 payment protocol that enables instant, automatic cryptocurrency payments directly over HTTP. Unlike traditional x402 facilitators that only support USDC, AnySpend allows you to pay with any token while resource servers receive any token they prefer. The x402 protocol modernizes the HTTP402 Payment Required status code, turning it into a practical solution for machine-to-machine micropayments, paywalled APIs, and autonomous agent interactions.
For Buyers (Payers)
Pay for paywalled resources using any cryptocurrency you hold:- Pay with any token: Use ETH, DAI, or any ERC-20 token - not just USDC
- Standard protocol: Works with any x402-enabled service using standard HTTP
- No manual swaps: AnySpend automatically converts your token to what the seller needs
- Simple integration: One SDK works across all x402 services
- Access premium APIs and AI agent services
- Pay for computational resources and data feeds
- Enable autonomous agent-to-agent payments
- Consume paywalled content programmatically
For Sellers (Resource Servers)
Accept payments in USDC while your customers pay with their preferred token:- Receive USDC: Get paid in USDC regardless of what token the customer uses
- Express middleware: Add payments to your API with just a few lines of code
- No blockchain infrastructure: AnySpend handles all on-chain complexity
- Instant settlement: Payments are verified and settled automatically
- Monetize premium APIs and data services
- Build paid AI agent workflows
- Create paywalled content and tools
- Accept crypto payments without crypto expertise
Quick Start
Choose your path:I want to pay for services
For Buyers: Learn how to use the x402 client SDK to pay for paywalled resources with any token
I want to accept payments
For Sellers: Add the Express middleware to your API and start accepting multi-token payments
How It Works
1
Client Requests Resource
User’s application makes a standard HTTP request to your API
2
Payment Required
Your API returns 
402 Payment Required with payment details3
Token Preference
Client specifies their preferred payment token (ETH, DAI, etc.)
4
AnySpend Quotes
AnySpend calculates the equivalent amount in the client’s chosen token
5
Client Signs Payment
User signs a cryptographic authorization for their token
6
Automatic Settlement
AnySpend swaps the token to USDC and settles to your wallet
7
Resource Delivered
Your API receives payment confirmation and returns the requested resource
Key Differentiators
Multi-Token Support
Standard x402: Resource servers and clients must both use USDC AnySpend x402: Clients pay with any token they hold. AnySpend handles the conversion.No Infrastructure Required
Resource servers don’t need to:- Run blockchain nodes
- Manage wallets or private keys
- Handle token swaps or bridging
- Monitor transaction status
Standard Protocol Compliance
Clients using AnySpend have zero awareness they’re using a special facilitator. The entire flow uses standard x402 protocol messages - the multi-token magic happens transparently on the resource server side through middleware.Package Delivery
AnySpend x402 consists of two packages:Server SDK
@b3dotfun/anyspend-x402Universal server middleware supporting Express, Next.js, and Hono for resource servers to easily accept multi-token payments
Client SDK
anyspend-x402-clientPlatform-agnostic TypeScript SDK for clients to make payments with signature helpers
Powered by AnySpend Facilitator
All x402 payments are processed through the AnySpend Facilitator - a production-grade payment infrastructure that handles:- ✅ Multi-token support across 19+ blockchain networks
- ✅ Automatic token swaps and cross-chain routing
- ✅ Gasless payments for users
- ✅ Standards-compliant x402 implementation
- ✅ Drop-in replacement for any x402 facilitator
https://mainnet.anyspend.com/x402
Learn More About the Facilitator
Discover the full capabilities, API endpoints, and architecture of the AnySpend Facilitator
 HypeDuel
HypeDuel