Manage your servers with freedom and control. Learn more about the new Forge

Cashier v11

We're very excited to announce the immediate availability of Cashier v11. This release of Cashier introduces support for Multiplan Subscriptions as well as Stripe's new Tax Rates feature.

Multiplan Subscriptions

Multiplan subscriptions allow you to assign multiple billing plans to a single subscription. For example, imagine you are building a customer service "helpdesk" application that has a base subscription of $10 per month, but offers a live chat add-on plan for an additional $15 per month:

1$user = User::find(1);
2 
3$user->subscription('default')->addPlan('chat-plan');

Now the customer will have two plans on their default subscription. The example above will add the new plan and the customer will be billed for it on their next billing cycle. If you would like to bill the customer immediately you may use the addPlanAndInvoice method:

1$user->subscription('default')->addPlanAndInvoice('chat-plan');

You may remove plans from subscriptions using the removePlan method:

1$user->subscription('default')->removePlan('chat-plan');

If you would like to update quantities on individual subscription plans, you may do so using the existing quantity methods and passing the name of the plan as an additional argument to the method:

1$user = User::find(1);
2 
3$user->subscription('default')
4 ->incrementQuantity(5, 'chat-plan');
5 
6$user->subscription('default')
7 ->decrementQuantity(3, 'chat-plan');
8 
9$user->subscription('default')
10 ->updateQuantity(10, 'chat-plan');

Tax Rates

To specify the tax rates a user pays on a subscription, implement the taxRates method on your billable model, and return an array with the Tax Rate IDs. You can define these tax rates in your Stripe dashboard:

1public function taxRates()
2{
3  return ['tax-rate-id'];
4}

The taxRates method enables you to apply a tax rate on a model-by-model basis, which may be helpful for a user base that spans multiple countries and tax rates. If you're working with multiplan subscriptions you can define different tax rates for each plan by implementing a planTaxRates method on your billable model:

1public function planTaxRates()
2{
3  return [
4    'plan-id' => ['tax-rate-id'],
5  ];
6}

For more thorough information and examples of using these new features, please consult the Cashier upgrade guide as well as the Cashier documentation.

We hope you enjoy this release and use it build amazing applications!

Keep reading