Basic Subscription System implementation logic

Hi
I am new to bubble, and building apps. I am planning to add a simple monthly subscription system (like in any SaaS) to my app. I’m not concerned about the payment gateway right now, but the basic logic of implementing a subscription/membership system. Let’s assume we have only 1 pricing plan.

What I have in mind right now is to use a scheduled workflow.
I set up two variables in USER datatype to store the no. of days remaining for the subscription, and the subscription status (Active/inactive).
X number of days are added to the "days remaining " variable once a user subscribes/renews his subscription.
Every day, the workflow will check how many days are remaining in the subscription, and change the subscription variable’s value to “Inactive” if days remaining are <1. And we check each time a user logs in, if the user’s subscription status is active or inactive. If inactive then we can redirect to the renewal page (or any other appropriate step as we decide).

Is this the right approach for handling subscriptions, or is there a better way to do this? Also, how would you calculate the days remaining by calculating the:
“expiry date - Today’s Date” ?
Any tutorial reference will be highly appreciated :slight_smile:

If you use stripe you should subscribe them to a plan. You won’t have to handle checking their subscriptions if set up properly. Stripe will automatically handle recurring payments.

If a payment fails, or a user unsubscribes, you set up webhooks so Stripe tells you. You’ll set up backend workflows/apis to account for users who unsubscribe or a payment failed.

T
Learn no code - > nocodify.com

Hi @deejay.shani , how are you?

This is not the best approach for what you are looking for.

The best way is to create another datatype called “Subscriptions”, basically with two columns: User and Expiration date.

When a User click to subscribe, you will create a Subscription where the User will be the “Current User” and the Expiration date will be, let’s say “Current Date + 30 days” (One month).

After your user logs in, the system will make a Search for Subscriptions where the User = Current User and Expiration date >= Current Date. If the result of this search is > 0 then you know that the Current User is in a valid plan. There is no need to keel calculating the remaining days…

Doing this way, you will have much more control of your app and subscription, and you will also be able to generate the history of the User and all your subscriptions…

1 Like

As I specified in the post, I am not looking for a stripe/gateway integration method.
This post is just to validate the workflow logic behind the implementation of a subscription/membership system.
We are looking at offline payments/Bank transfers that can not be traced digitally, if that helps :slight_smile:

Thank you man. That was a clear explanation. This approach definitely seems much better :grinning: I appreciate you taking your time to respond!

1 Like