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:

$user = User::find(<span class="hljs-number">1</span>);

$user->subscription(<span class="hljs-string">'default'</span>)->addPlan(<span class="hljs-string">'chat-plan'</span>);

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:

$user->subscription(<span class="hljs-string">'default'</span>)->addPlanAndInvoice(<span class="hljs-string">'chat-plan'</span>);

You may remove plans from subscriptions using the removePlan method:

$user->subscription(<span class="hljs-string">'default'</span>)->removePlan(<span class="hljs-string">'chat-plan'</span>);

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:

$user = User::find(<span class="hljs-number">1</span>);

$user->subscription(<span class="hljs-string">'default'</span>)
     ->incrementQuantity(<span class="hljs-number">5</span>, <span class="hljs-string">'chat-plan'</span>);

$user->subscription(<span class="hljs-string">'default'</span>)
     ->decrementQuantity(<span class="hljs-number">3</span>, <span class="hljs-string">'chat-plan'</span>);

$user->subscription(<span class="hljs-string">'default'</span>)
     ->updateQuantity(<span class="hljs-number">10</span>, <span class="hljs-string">'chat-plan'</span>);

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:

<span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">taxRates</span><span class="hljs-params">()</span>
</span>{
  <span class="hljs-keyword">return</span> [<span class="hljs-string">'tax-rate-id'</span>];
}

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:

<span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">planTaxRates</span><span class="hljs-params">()</span>
</span>{
  <span class="hljs-keyword">return</span> [
    <span class="hljs-string">'plan-id'</span> => [<span class="hljs-string">'tax-rate-id'</span>],
  ];
}

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

Stay connected with the latest Laravel news