Per Team User Subscription in Laravel Spark
If you want the ability to charge a team owner based on how many members their team has, like $10/user/month, then you utilize the Laravel Cashier functionality of incrementing the quantity.
You listen for when a new team member is added and you increase the quantity of the subscription by the amount of users and also listen for when a team member is removed to downsize charges. - Not Braintree Compatible
'Laravel\Spark\Events\Teams\TeamMemberAdded' => [
'App\Listeners\UpdatePerUserCharge'
],
'Laravel\Spark\Events\Teams\TeamMemberRemoved' => [
'App\Listeners\UpdatePerUserCharge'
],
<?php
namespace App\Listeners;
class UpdatePerUserCharge
{
public function handle($event)
{
$userCount = $event->team->users()->count();
$event->team->subscription()->updateQuantity($userCount);
}
}
Made by: @dillinghamio Find More Awesome Spark Stuff Here
Accounts can have multiple teams, so how do you denote for which team the user is billed for? If I have a sass company where I want to charge a company $10 per user per month and then let that company create teams for various permissions issues, how do I decide which of those teams I am billing for?