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

douglas_quaid's avatar

How Would I handle this payment situation?

Hi,

I want to customize the Spark subscription plans to allow for a user to buy individual courses and get access to them for a period of time. For example,

A user can purchase a course for $x and get access to it for a year, until it expires.
A user can only view a course that he has purchased and there is time remaining on that subscription.

I found in the stripe docs that you can actually create a single base plan and then use quantities to determine how many a user would subscribe to

ex. Each course costs $10. A user wants access to 2 courses, the quantity would be 2 and the total would be $20/year

https://stripe.com/docs/subscriptions/quantities

My question now becomes, how do I determine which courses they would have access to? Do I store that on stripes side or in my database based on their selection?

Thanks. Any help would be much appreciated :)

0 likes
2 replies
henninghorn's avatar

Hi @douglas_quaid

You should keep track of which courses a user has access to. Basically you'll need a many-to-many relationship between the user and the course, and you could add pivot fields containing when a user got access and when their access is no longer valid.

Does that make sense?

Please or to participate in this conversation.