Skip to main content
Per-unit pricing charges customers based on the quantity of a resource they use — seats, workspaces, environments, or any other non-consumable feature. Customers either commit to a quantity upfront (prepaid) or are billed based on actual usage at the end of each billing cycle (usage-based).
Example
A collaboration tool charges $10/seat/month. The plan includes 5 seats for free, and each additional seat costs $10.

Setting up

Create a non-consumable metered feature and add it to a plan with a per-unit price:
autumn.config.ts
import { feature, item, plan } from 'atmn';

export const seats = feature({
  id: 'seats',
  name: 'Seats',
  type: 'metered',
  consumable: false,
});

export const pro = plan({
  id: 'pro',
  name: 'Pro',
  price: { amount: 20, interval: 'month' },
  items: [
    item({
      featureId: seats.id,
      included: 5,
      price: {
        amount: 10,
        interval: 'month',
        billingMethod: 'usage_based',
      },
    }),
  ],
});
Push changes with atmn push.

Billing methods

MethodBehavior
PrepaidCustomer commits to a quantity at checkout and pays immediately. To change quantity, they update their subscription.
Usage-basedCustomer is billed for the actual number of units at the end of each billing cycle.

Prepaid per-unit

With prepaid, the customer selects a quantity when purchasing. Pass the quantity via options:
import { Autumn } from "autumn-js";

const autumn = new Autumn({ secretKey: "am_sk_..." });

const { data } = await autumn.checkout({
  customer_id: "user_123",
  plan_id: "pro",
  options: [{
    feature_id: "seats",
    quantity: 10,
  }],
});

Usage-based per-unit

With usage-based billing, track seat additions and removals as they happen. Autumn bills the total at the end of the billing cycle.
import { Autumn } from "autumn-js";

const autumn = new Autumn({ secretKey: "am_sk_..." });

await autumn.track({
  customer_id: "user_123",
  feature_id: "seats",
  value: 1,
});

Checking access

Before allowing a user to add a new seat, check if they have capacity:
const { data } = await autumn.check({
  customer_id: "user_123",
  feature_id: "seats",
});

if (!data.allowed) {
  // Prompt user to purchase more seats
}

Proration on quantity changes

When a customer increases or decreases their seat count mid-billing-cycle, you can configure how the price adjustment is handled. See Proration for details.