Learn how to create your first plan, customer and subscription in Baremetrics.
Getting your first customer into Baremetrics requires three steps! The steps must be completed in order, however. For example, you can't create a subscription without first creating a customer and a plan.
You only need to create a plan once! It can be used over and over again for multiple customers and subscriptions.
Before you begin, snag the Source ID for the provider Baremetrics. You will need this anytime you create, modify or interact with plans, customers, subscriptions or charges through the API.
Create a Plan
Let's create a $10/mo. plan called *Basic Plan. Here's what that looks like.
The amount is in cents. So for our $10/mo. plan we will use an amount of
1000
.
RestClient.post "https://api.baremetrics.com/v1/:source_id/plans", {
oid: 'basic_plan',
name: 'Basic',
currency: 'usd',
amount: 1000,
interval: 'month',
interval_count: 1
}
If you did everything right, you'll get a 200 response with your new plan details!
{
"plan": {
"oid": "basic_plan",
"source_id": "123",
"source": "baremetrics",
"name": "Basic",
"interval": "month",
"interval_count": 1,
"trial_duration": null,
"trial_duration_unit": null,
"created": null,
"active": true,
"setup_fees": 0,
"amounts": [
{
"currency": "USD",
"symbol": "$",
"symbol_right": false,
"amount": 1000
}
]
}
}
Create a Customer
Once you have at least one plan you can start creating customers.
You only need to provide us a unique ID to create a customer. However to get the best experience, we recommend sending Baremetrics as much data as possible!
RestClient.post "https://api.baremetrics.com/v1/:source_id/customers", {
oid: '123123123', # Provide a unique ID for the customer
name: 'Josh Pigford',
notes: 'Salesperson: Kaegan Donnelly', # This will populate the notes field in the customer profile
email: '[email protected]', # We use the email address to retrieve social data about your customer such as a picture and location
created: 1471343207 # The unix date "created" date for a customer. We add this to the customer profile as well.
}
If everything goes as planned, we'll return a 200 response with more details about the customer that you've created!
{
"customer": {
"oid": "123123123",
"source_id": "source_1",
"source": "stripe",
"created": 1471343207,
"email": "[email protected]",
"name": "Josh Pigford",
"display_image": "https://logo.clearbit.com/baremetrics.com",
"display_name": "Customer 1",
"notes": 'Salesperson: Kaegan Donnelly',
"ltv": 0,
"is_active": false,
"is_canceled": false,
"current_mrr": 0,
"current_plans": []
}
}
Create a Subscription
Alright, you're most of the way there! If you look at your Baremetrics dashboard though you won't see a whole lot. Since Baremetrics is all about tracking your subscriptions, this final step is crucial to getting your key metrics and insights!
You can get really fancy with subscriptions with things like addons and quantities, but we're going to keep this first one really simple.
RestClient.post "https://api.baremetrics.com/v1/:source_id/subscriptions", {
oid: 'abcdabcd', # A unique ID for the subscription
started_at: 1471887288, # The date the subscription begins
canceled_at: nil, # The date the subscription ends, if applicable
plan_oid: 'basic_plan', # The ID of the plan you created earlier
customer_oid: '123123123', # The ID of the customer you created earlier
}
Metrics generally update about once every 30 minutes, but it can take a couple of hours at times. Check the "Last Updated" date at the top right of your dashboard to see when we last calculated your metrics.
Here's what your finished subscription customer will look like in Baremetrics!