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

jcf's avatar
Level 1

Trouble getting quantity from DB in laravel cashier

I have a web app that different users will subscribe with a different quantity. I can hand edit vendor/laravel/cashier/src/SubscriptionBuilder.php the line protected $quantity = 1 and make it more than 1 and it bills correctly at stripe. But when I try to get that variable from a DB lookup it gives the 500 error. Any ideas how to get that variable from a DB lookup? A little confused on the layers of this onion.

FYI, I have a separate table that returns what the user's quantity should be, it's not the quantity field in subscription table as I understand that is for after they have subscribed.

Also FYI, I am using spark, not that that should matter since this is in the cashier code.

Thanks

0 likes
1 reply
jcf's avatar
Level 1

Sorry for the not very detailed post. I ended up editing spark/src/Interactions/Subscribe.php and added a DB lookup that got the quantity for that user. Then just dropped the = 1 in subscriptionBuilder.php in cashier and it works fine.

In case anyone cares to do quantity subscriptions in laravel spark, maybe this will help a bit.

Cheers

Please or to participate in this conversation.