Reputation: 166156
In Laravel Spark, (it's my understanding) you can tie your billing plan to a billing plan already setup in Stripe with code that looks something like this
Spark::plan('Basic', 'provider-id-1')
->price(10)
->features([
'First', 'Second', 'Third'
]);
where provider-id-1
is the Stripe ID of you billing plan. The 10
listed as price is used for local display -- the actual price is setup in Stripe. (if this is incorrect, please let me know)
Does Laravel Spark support Stripe's concept of quantities? I don't see anything about this in the docs, but I'm sometimes bad at reading docs.
If not -- has anyone extended Laravel Spark to use quantities. If so, what was involved? I assume you'd need to
Change the Strip API behavior to send along quantities when subscribing a user
Change Laravel display code to display a quantity based pricing
More things that didn't occur to me?
If Laravel spark doesn't support quantities, does anyone know which classes/files are responsible for the two items above? (particularly the Stripe API classes)
Upvotes: 0
Views: 713
Reputation: 9146
Out of the box, Spark does not let you set a quantity while subscribing.
However, because Spark uses Cashier under the hood, and because Cashier has the concept of quantity, you should be able to either swap
in your own Subscribe class, or you can possibly do something like this (untested):
$subscription = $user->billable->subscription();
$subscription->quantity(5);
$subscription->save();
As for the UI, that will have to be custom built.
Upvotes: 2