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

davidxd33's avatar

[Urgent Advice] Using laravel cashier to manage "license keys".

You'll be my hero if you help me design this system. I'm not asking for code, just advice.

I've been sitting here all day thinking about how I would do this. My application is serving as a download center and users can log on and buy software and they get a license key for it.

As of right now, I've edited LC to accept general charges on a card. This granted the ability to make one time purchases so.. buying the download. Now, with every download comes a free license key. For additional license keys, the fee costs 10% the cost of the download.

Bare with me please, I need to be able to bill the user every month for every additional license key they purchase. So now, I need to find a way to store purchased keys and bill the user monthly for every key they own.

I'm not asking for code, I'm asking for some help on how to lay this system out. What part of Stripe do I need and what part of LC needs more tweaking to make this happen.

This is my largest project to date and my brain is self destructing the more I think about the system. It's probably much easier than it looks.

TL;DR: I need to find a way to track license keys for products and bill the user per month for each license key they own. A single product can have as many licenses so I'm guessing ->increment()?

My guesses:

  • Dynamically create license key plans on Stripe when a product is made locally.
  • That's it.

Which parts of cashier do I need to edit / add? How should my database look?

0 likes
3 replies
bashy's avatar

Have a license table, relate that to purchases (which is related to users)? Can count how many licenses a purchase or user has.

As for Cashier, not used it so not sure on that part.

davidxd33's avatar

@bashy

Licenses table contains: id, purchase_id, stripe_plan, license_key, active

Purchases table contains: id, user_id, stripe_charge_id

Yea cool I can track the amount of licenses but I'm afraid is only the easy part. The complicated part is the recurring billing that occurs every month for each additional license key a product has. Let's say the card was declined on month three, I need to track down that license key and let's say.. deactivate it. The licenses should always remain on the user account be just be "deactivated." but this is all local stuff. My main concern is keeping this with Stripe and creating these recurring license plans with Stripe.

Thanks for your input though.

bashy's avatar

Running a cron or task to update those totals for Stripe?

Maybe you'd have to tab into the code a bit and make a method to add additional licenses and increment the price accordingly.

This would just add to the price of the base amount so not really useful

$user->subscription()->increment(1);

Please or to participate in this conversation.