Quick Start Guide
10 minGet up and running with Bear Billing in 10 minutes. This guide will walk you through creating your first customer, subscription, and tracking AI usage.
Node.js SDK Now Available
AlphaOur Node.js SDK is now available as an alpha release. Install it with npm install @bearbilling/node-sdk@alpha
Python SDK coming soon. In the meantime, you can also use our REST API directly from any language.
Alpha releases are for early testing. Your feedback helps shape the stable release.
Prerequisites
- A Bear Billing account (sign up here)
- An API key from your (dashboard settings)
- Node.js 18+ or Python 3.9+ installed (or use REST API from any language)
Installation & Setup
SDK Installation
Install the Bear Billing Node.js SDK:
npm install @bearbilling/node-sdk@alphaInitialize the Client
Set up your API client with your API key:
import { BearBilling } from '@bearbilling/node-sdk';
const bearBilling = new BearBilling({
apiKey: process.env.BEAR_BILLING_API_KEY,
});Create a Customer
First, create a customer record in Bear Billing:
const customer = await bearBilling.customers.create({
email: '[email protected]',
name: 'Acme Corporation',
metadata: {
userId: 'user_123',
plan: 'pro'
}
});
console.log('Customer created:', customer.id);Create a Subscription
Now create a subscription for your customer:
const subscription = await bearBilling.subscriptions.create({
organizationId: customer.id,
planId: 'plan_pro_monthly',
billingCycle: 'monthly',
startDate: new Date().toISOString()
});
console.log('Subscription created:', subscription.id);
console.log('Status:', subscription.status);Track Usage
OptionalIf you're using usage-based billing, record usage events:
await bearBilling.usage.record({
subscriptionId: subscription.id,
metricName: 'api_calls',
quantity: 100,
timestamp: new Date().toISOString()
});You're all set!
You've successfully integrated the basics of Bear Billing. Now let's explore what you can do next.