Prerequisites
Node.js
v20.15.0 or higher
React
Version 18 or 19
TypeScript
Recommended for better DX
Installation
Choose your preferred package manager:- npm
- pnpm
Basic Setup
1. Provider Setup
Wrap your app with theB3Provider
and AnyspendProvider
to enable AnySpend functionality:
App.tsx
2. Environment Configuration
- Mainnet
- Testnet
Endpoint:
https://mainnet.anyspend.com
Use this for production applications with real transactions.3. TypeScript Configuration (Optional but Recommended)
If you’re using TypeScript, ensure your
tsconfig.json
includes these settings for optimal compatibility:tsconfig.json
Verification
Create a simple test component to verify your setup works correctly:TestComponent.tsx
Next Steps
Explore Components
Learn about available components for different payment scenarios
Learn about Hooks
Discover React hooks for building custom payment flows
See Examples
Browse real-world implementation examples
Troubleshooting
Import Errors
Import Errors
Make sure you’ve installed the SDK correctly and imported the CSS file. The SDK requires React 18+ and may have compatibility issues with older versions.
Provider Not Found
Provider Not Found
Ensure you have
B3Provider
and AnyspendProvider
placed high in your component tree, typically in your main App component.TypeScript Errors
TypeScript Errors
If you’re seeing TypeScript errors, verify your
tsconfig.json
includes the recommended settings above.