How To Create Per-Seat Billing With Stripe

Kyle Gawley
Kyle Gawley
Gravity founder
How To Create Per-Seat Billing With Stripe

Do you want to charge your SaaS customers based on the number of users they have?

Pr-seat billing is straightforward to implement, thanks to volume pricing in Stripe. The good news is: there's no need to manage multiple subscriptions; you can scale the volume on a single subscription when a new user is added or deleted. The other good news is: there's no bad news!

1. Create a Volume Price Plan in Stripe

In your Stripe dashboard, create a new product (if you haven't already) then create a new price for it.

For the pricing model, choose Volume pricing and then enter a value for the 1st and 2nd units. The first unit is how much the account owner will be charged monthly. The second unit is the cost for each additional user (per month or whichever interval you've chosen).

2. Scaling The Volume in Your App

When a new account signs up in your app, create a new Stripe customer and subscription. For example, you'd have something like this:

const customerData = await stripe.customers.create({

  email: 'name@domain.com',
  source: token_from_client

 });

const subscription = await stripe.subscriptions.create({

  customer: customerData.customer.id,
  items: [{ plan: 'stripe_plan_id' }],
  enable_incomplete_payments: true,
  expand: ['latest_invoice.payment_intent']

 });

Next, when a new user is added to an account, increment the volume of that subscription:

const users = await user.get({ account: accountId });
const subscription = await stripe.subscriptions.retrieve(subscriptionId);

await stripe.subscriptions.update(subscription.id, {

  items: [{ 
        
    id: subscription.items.data[0].id, 
    plan: 'stripe_plan_id',
    quantity: users.length+1
      
  }]
});

When a user is deleted, you'll also want to decrement the subscription volume:

const users = await user.get({ account: accountId });
const subscription = await stripe.subscriptions.retrieve(subscriptionId);

await stripe.subscriptions.update(subscription.id, {

  items: [{ 
        
    id: subscription.items.data[0].id, 
    plan: 'stripe_plan_id',
    quantity: users.length-1
      
  }]
});

That's it. Super easy, right? If you don't want to do it yourself, my Node.js SaaS boilerplate includes per-seat billing for you out-of-the-box to save you the hassle 💪🏻

Download The Free SaaS Boilerplate

Build a full-stack web application with React, Tailwind and Node.js.