Installation & setup

Install the SDK, set up providers, and verify everything works

Prerequisites

Node.js

v20.15.0 or higher

React

Version 18 or 19

TypeScript

Recommended for better DX

Installation

Choose your preferred package manager:

bash
npm install @b3dotfun/sdk
bash
pnpm add @b3dotfun/sdk

Basic Setup

1. Provider Setup

Wrap your app with the B3Provider and AnyspendProvider to enable AnySpend functionality:

tsx
import { AnyspendProvider } from "@b3dotfun/sdk/anyspend/react"; import { B3Provider } from "@b3dotfun/sdk/global-account/react"; import "@b3dotfun/sdk/index.css"; function App() { return ( <B3Provider theme="light" environment="production" partnerId="your-awesome-partner-id"> <AnyspendProvider>{/* Your app components */}</AnyspendProvider> </B3Provider> ); } export default App;

2. Environment Configuration

Endpoint: https://mainnet.anyspend.com

Use this for production applications with real transactions.

Endpoint: http://testnet.anyspend.com

Use this for development and testing with test tokens.

Note: Testnet is currently not available.

Note

If you're using TypeScript, ensure your tsconfig.json includes these settings for optimal compatibility:

json
{ "compilerOptions": { "moduleResolution": "node", "allowSyntheticDefaultImports": true, "esModuleInterop": true } }

Verification

Create a simple test component to verify your setup works correctly:

tsx
import { AnySpend } from "@b3dotfun/sdk/anyspend/react"; function TestComponent() { return <AnySpend />; }

Next Steps

Explore Components

Learn about available components for different payment scenarios

Learn More
Learn about Hooks

Discover React hooks for building custom payment flows

Learn More
See Examples

Browse real-world implementation examples

Learn More

Troubleshooting

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.

Ensure you have B3Provider and AnyspendProvider placed high in your component tree, typically in your main App component.

If you're seeing TypeScript errors, verify your tsconfig.json includes the recommended settings above.

Ask a question... ⌘I