Best Practices for Applying Complex-ish Subscription Rules

Posted 4 years ago by CrtlAltDylan

I'm excited because my application is getting to a point where I can charge customers ( awesome) and this means I get to implement a payment service.

I've already installed Stripe and Cashier as my payment and payment processing services. However I have some subscription rules that are somewhat complex. Here's just a small sample of the rules:

A basic plan has 1 Artist and 10 Shows. After 10 Shows a $Y amount is charged per Show.

A premium plan has up to 5 Artists and 50 Shows. After 50 Shows a $Y amount it charged per Show.

I will soon have to apply different rules to different user account types. What are some methods that you all use to verify that a User can perform certain actions? I'm thinking that this calls for a separate service altogether that's called on certain routes and before actions are performed:

 SubscriptionChecker::check($action, $user);

Will be responsible for simply checking if the user's account is able to perform the action.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.