Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

replicant's avatar

Cashier / Stripe Per Seat Subscriptions

Hi all,

My client has a Laravel app with Cashier + Stripe. Her business model is charging a monthly subscription for the number of users active in the account. Currently when the subscription is initially created the customer is charged their first user fee but subsequent users added to the account are only added to the next invoice and not charged right away.

We could do a one off charge but it feels messy.

Is there a way to increment a subscription and charge for the difference all in one shot?

Looking for guidance on how others may be accomplishing this? or if I'm not understanding how Stripe subscriptions work?

Thanks much :)

0 likes
4 replies
tisuchi's avatar

@replicant You can use the Stripe Subscription's quantity property to increment the number of users on the subscription and charge for the difference.

You can do this by calling the updateQuantity method on the subscription object and passing in the new quantity. This will automatically calculate the prorated charge for the difference in the quantity and charge the customer's card.

For example-

// Get the Stripe Subscription object
$subscription = $user->subscription('default');

// Increment the quantity by the number of new users
$subscription->updateQuantity($subscription->quantity + $numNewUsers);

// The customer's card will be charged for the prorated difference in the quantity

Keep in mind that this will only work if you have enabled proration for your subscriptions in Stripe. You can do this by setting the prorate parameter to true when creating or updating the subscription.

2 likes
replicant's avatar

@tisuchi Thank you so much for the response. In your example would you expect the prorated amount to be charged right away or would it just be applied to the next invoice?

At the moment I have my code setup the same as you and I believe the subscription is set to prorate. When I increment the subscription the prorated amount is just added to the next invoice.

1 like
tisuchi's avatar
tisuchi
Best Answer
Level 70

@replicant Yes, the prorated difference in the subscription quantity should be added to the next invoice. If you want to charge the customer for the prorated difference immediately, you can create a new invoice for the customer with the auto_advance_invoice_itemsparameter set to true. This will create and pay a new invoice for the customer with the prorated difference in the subscription quantity.

For example-

// Get the Stripe Subscription object
$subscription = $user->subscription('default');

// Increment the quantity by the number of new users
$subscription->updateQuantity($subscription->quantity + $numNewUsers);

// Create a new invoice for the customer with the "auto_advance_invoice_items" parameter set to true
$invoice = $user->createInvoice(['auto_advance_invoice_items' => true]);

// Pay the invoice
$invoice->pay();

This will create and pay a new invoice for the customer with the prorated difference in the subscription quantity, and the customer's card will be charged for the prorated difference immediately.

3 likes
replicant's avatar

@tisuchi Ok I think I have this working perfectly. Here's what I have.

auto_advance_invoice_items couldn't be found as a parameter but I did find auto_advance and I needed to add pending_invoice_items_behavior as an additional parameter.

$invoice = $account->createInvoice([
    'pending_invoice_items_behavior' => 'include', // Adds the pending line items to the invoice
    'auto_advance' => true // tells Stripe to perform auto collection on the invoice
]);

$invoice->pay();

Thank you so much for the nudge in the correct direction. Very much appreciated!

1 like

Please or to participate in this conversation.