Set up a per-user (or ‘per-seat) pricing like Notion , the collaboration software for innovative teams, including plans based on the number of users and prepaid credits.
In this template, you will learn how to build a ‘fair’ billing system, with charges calculated according to the number of days of use.
This template is suitable for companies whose pricing depends on persistent metrics, such as productivity software (e.g. number of days users are active), fintechs (e.g. number of days payment cards are active) and data platforms (e.g. number of days integrations are active).
Pricing structure
Notion offers a Personal Pro plan for individuals who want to collaborate with friends or clients, and a Team plan through which members can set up a collaborative workspace. While the Personal Pro plan is limited to one member, the Team plan allows companies to invite as many members as they need.
Model Team plan Price $10 per user billed monthly
Get started
Set up Lago
cURL
Python
Ruby
Javascript
Go
LAGO_URL = "https://api.getlago.com"
API_KEY = "__API_KEY__"
Create a billable metric
Create a recurring billable metric to track user activity over time.
Add a unique code
for your billable metric
Set the aggregation_type
to unique_count_agg
for counting unique users
Set the field_name
to user_id
to identify individual users
Set recurring
to true
for persistent tracking across billing periods
cURL
Python
Ruby
JavaScript
Go
curl --location --request POST " $LAGO_URL /api/v1/billable_metrics" \
--header 'Authorization: Bearer __API_KEY__' \
--header 'Content-Type: application/json' \
--data-raw '{
"billable_metric": {
"name": "Active Users",
"code": "__BILLABLE_METRIC_CODE__",
"description": "Number of active users in the workspace",
"aggregation_type": "unique_count_agg",
"field_name": "user_id",
"recurring": true
}
}'
Refer to the API reference and the guide on recurring metrics to learn more.
Create a plan
Create a plan with prorated charges for fair per-seat billing.
Set the amount_cents
to 0
since there is no subscription fee
Set the charge_model
to standard
for simple per-unit pricing
Enable prorated
billing for fair daily calculations
Set the amount
to 10
for $10 per user per month
cURL
Python
Ruby
Javascript
Go
curl --location --request POST " $LAGO_URL /api/v1/plans" \
--header 'Authorization: Bearer __API_KEY__' \
--header 'Content-Type: application/json' \
--data-raw '{
"plan": {
"name": "Team Plan",
"code": "__PLAN_CODE__",
"description": "Per-seat pricing for team collaboration",
"amount_cents": 0,
"amount_currency": "USD",
"interval": "monthly",
"pay_in_advance": false,
"charges": [
{
"billable_metric_code": "__BILLABLE_METRIC_CODE__",
"charge_model": "standard",
"invoiceable": true,
"prorated": true,
"properties": {
"amount": "10"
}
}
]
}
}'
Refer to the API reference and the guide on prorated charges to learn more.
Create a customer
Create a customer with a unique external_id
.
cURL
Python
Ruby
Javascript
Go
curl --location --request POST " $LAGO_URL /api/v1/customers" \
--header "Authorization: Bearer $API_KEY " \
--header 'Content-Type: application/json' \
--data-raw '{
"customer": {
"external_id": "__EXTERNAL_CUSTOMER_ID__",
"name": "Acme Inc",
"email": "john@acme.com",
"currency": "USD",
"timezone": "America/New_York"
}
}'
Refer to the API reference to create a customer.
Create a subscription
Create a subscription for the customer with the plan’s code
.
cURL
Python
Ruby
Javascript
Go
curl --location --request POST " $LAGO_URL /api/v1/subscriptions" \
--header "Authorization: Bearer $API_KEY " \
--header 'Content-Type: application/json' \
--data-raw '{
"subscription": {
"external_customer_id": "__EXTERNAL_CUSTOMER_ID__",
"plan_code": "__PLAN_CODE__",
"external_id": "__EXTERNAL_SUBSCRIPTION_ID__"
}
}'
Refer to the API reference to create a subscription.
Ingest user activity events
Send usage events to Lago to track usage.
Reference your billable metric with code
Reference the customer’s subscription with external_subscription_id
Include user_id
in properties to track individual users
Set operation_type
to add
when adding users, remove
when removing
cURL
Python
Ruby
Javascript
Go
curl --location --request POST " $LAGO_URL /api/v1/events" \
--header 'Authorization: Bearer __API_KEY__' \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"transaction_id": "__TRANSACTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"external_subscription_id": "__EXTERNAL_SUBSCRIPTION_ID__",
"properties": {
"user_id": "user_123",
"operation_type": "add"
}
}
}'
Refer to the API reference to create an event.
Monitor current usage
Track real-time customer usage for the current billing period.
cURL
Python
Ruby
Javascript
Go
curl --location --request GET " $LAGO_URL /api/v1/customers/__EXTERNAL_CUSTOMER_ID__/current_usage?external_subscription_id=__EXTERNAL_SUBSCRIPTION_ID__" \
--header 'Authorization: Bearer __API_KEY__' \
--header 'Content-Type: application/json'
Refer to the API reference to get the current usage.
Wrap-up
For software companies like Notion, implementing a ‘fair’ per-user pricing model is a good way to increase transparency and customer satisfaction .
With Lago, you can create your own persistent metrics to adapt this template to your products and services.
Give it a try, click here to get started!