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.

ModelTeam plan
Price$10 per user billed monthly

Get started

1

Set up Lago

LAGO_URL="https://api.getlago.com"
API_KEY="__API_KEY__"
2

Create a billable metric

Create a recurring billable metric to track user activity over time.

  1. Add a unique code for your billable metric
  2. Set the aggregation_type to unique_count_agg for counting unique users
  3. Set the field_name to user_id to identify individual users
  4. Set recurring to true for persistent tracking across billing periods
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.

3

Create a plan

Create a plan with prorated charges for fair per-seat billing.

  1. Set the amount_cents to 0 since there is no subscription fee
  2. Set the charge_model to standard for simple per-unit pricing
  3. Enable prorated billing for fair daily calculations
  4. Set the amount to 10 for $10 per user per month
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.

4

Create a customer

Create a customer with a unique external_id.

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.

5

Create a subscription

Create a subscription for the customer with the plan’s code.

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.

6

Ingest user activity events

Send usage events to Lago to track usage.

  1. Reference your billable metric with code
  2. Reference the customer’s subscription with external_subscription_id
  3. Include user_id in properties to track individual users
  4. Set operation_type to add when adding users, remove when removing
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.

7

Monitor current usage

Track real-time customer usage for the current billing period.

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!