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.
SDKs Coming Soon
AlphaWe have SDKs ready to go and they'll be released as alpha versions for our first customers.
We encourage users to play around with our REST API, which is autogenerated from our codebase. API docs are a first-class concern in our development cycle.
The examples below show the future SDK interface for reference.
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
Coming SoonOnce SDKs are released as alpha versions, you'll install them with:
npm install @bearbilling/node-sdk@alphaFor now, use the REST API directly. Examples below show the planned SDK interface for reference.
Initialize 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: 'customer@example.com',
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.