Is there a way to create dynamic plans in Spark based on user inputs?
For example, what if you have a product that is (unfortunately) a bit complicated and has to be priced differently based on the customer. Taking that further, maybe you have 3 arrays of questions with 3 radio buttons each. Based on each answer, you price accordingly. In that case you have 27 possible Plans you need to make ahead of time in your php file in Spark.
But what if it gets worse and for one of those answers, you then need to ask yet another question that maybe has 4 possible answers itself? Either way, you shouldn't have to write and maintain all of these Plans like this it seems.
Is there a way to have them dynamically made? Am I the only one who has encountered this problem?
LaravelSparkDynamicPlanProvider - Laravel Spark Service Provider that allows to create Plans with Eloquent and have them created on Stripe, automatically loading them into Spark.
If you were looking to limit functionality by plan, you could use middleware/policies.
The reason for plans being setup to be static is because they reference a Stripe plan in Stripe for a set price so if you want different plans, you'll need different plans in both Stripe and Spark.
If you want to filter the plans offered to the user based on user selection just update your view that shows plans and only show the plans with X,Y,Z based on your filtering criteria. If you need to create dynamic plans, use the package linked above.