Here’s the scenario:
My app gives subscribed users a monthly allocation of “Tokens” every month based on their subscription plan level. They use these tokens on performing actions within the app. When their tokens run out, they’re unable to perform any more actions that require tokens. At the beginning of each month, their tokens are reset.
How would I set this up? I have a user field where the number of tokens for that user is stored. I know how to subtract tokens from their profile when they perform actions. But I can’t figure out how to reset their tokens at the beginning of the month.
Any help or guidance would be much appreciated.
from their initial purchase, schedule a backend workflow that will reset their tokens a month away from current date.
Inside the backend workflow, the end of the workflow, make it schedule itself again another month out.
Can a user input an amount of tokens they’d like to buy? If not, is this a feature you would be open to looking into?
Yes, that sounds like what I need to do… but where I get stuck is the “How” part. 
1 Like
Yes, I have thought about an a-la-cart ability to add more tokens… but trying to focus on one thing at a time. The one-off purchase is probably easy… but every SaaS knows that MRR is the most sustainable business model, hence the focus on subscriptions.
I’'ll be happy to help with the how, big dog. Give me a sec to formulate some screen shots
1 Like
User adds an item to a cart - in my example i’m using a plugin that creates a cart for me, and the stripe checkout session.
User clicks a checkout button
The plugin will direct the user to a stripe hosted checkout session, your flow will probably be different, but after purchase, you’d do your schedule.
Here’s what the schedule looks like in backend workflows
Here’s what’s inside that action
now loop it
Reading through this all now to see if it sets off any lightbulbs. So this is for on-demand token purchases, right? I definitely want to create the subscription model workflow, but perhaps what I learn from this can apply somehow?
Thanks for taking the time to help! Still new to bubble, trying to figure it all out is dizzying! lol
1 Like
While this will create a monthly subscription for tokens the user got to choose, all you need to focus on is the scheduling of backend workflows, and the backend workflow itself.
Yea, I don’t think this will work for my setup. I need to find a way to tie it to Stripe and trigger the token refill when the user’s Subscription period start date changes and have it conditional that the Subscription status is “active”. I was thinking a database trigger event?
Thinking about it more (as I type lol)… that might not work for Yearly subscribers. Hmm…
Maybe for a free tier I could use your method, @doug.burden. That way it would just be based on the user’s signup date.
Why wouldn’t it work? You can run the workflow conditionally if the subscription is active. And the plug-in in the screen shots allows you to run checks on the subscription to check if it’s active, without having to use Webhooks. But I’d also be happy to help setup Webhooks for you, if you’re using bubbles Stripe plugin.
1 Like
I am using bubbles stripe plugin. I think that’s what’s confusing me.
Don’t be confused. Just focus on the backend workflow. Cuz that’s ultimately how you’re going to solve what you’re after.
1 Like
After some playing around, I think it finally clicked for me! Thank you for your help @doug.burden!
1 Like