General
Billing
Per Seat Billing
Learn how to set up per seat billing to charge customers for seats (users).
Per-seat billing is a common pricing model for SaaS applications where customers are charged based on the number of users (or "seats") in their organization.
The starter kit automatically:
- Detects if your pricing model uses per seat billing.
- Calculates seat count based on the number of organization members.
- Reports the seat count to your billing system during subscription.
- Updates the seat count when members are added or removed.
Billing configuration
Let's define two per_seats plans in packages/billing/src/config.ts:
packages/billing/src/config.ts
export const config = createBillingConfig({
products: [
{
id: 'starter',
name: 'Starter',
description: 'The perfect plan for teams',
label: 'Get started',
features: ['Feature 1', 'Feature 2'],
plans: [
{
id: 'plan-starter-month',
displayIntervals: [PriceInterval.Month],
trialDays: 7,
prices: [
{
id: 'price-starter-month-id',
type: PriceType.Recurring,
// [\!code highlight:1]
model: PriceModel.PerSeat
interval: PriceInterval.Month,
cost: 5,
currency: 'USD'
}
]
},
{
id: 'plan-starter-year',
displayIntervals: [PriceInterval.Year],
trialDays: 7,
prices: [
{
id: 'price-starter-year-id',
type: PriceType.Recurring,
// [\!code highlight:1]
model: PriceModel.PerSeat
interval: PriceInterval.Year,
cost: 50, // 20% discount
currency: 'USD'
}
]
}
]
}
]
});Good to know: The cost is primarily for UI display and reporting of current seats to the billing provider. Actual charges are managed by your billing provider. Ensure the correct values are set in your provider’s dashboard.
Automated seat reporting
Seat count reporting is handled automatically. The starter kit will sync the number of seats with your billing provider during subscriptions and whenever members are added or removed.