Reset a User's Credits every month starting from SignUp date

Hello,

I’m making an app that provides user’s with a certain number of credits for free every month (say 100 credits). I need the credits to reset every month starting from the date that the user signed up for the app.
I know that there are posts on this forum regarding something similar but it is still confusing and there’s nothing for this specific use case.
So can somebody please give me a step-by-step answer or guide me to someplace where I could find an answer?
I’m on the Personal plan and I do have access to Backend Workflows. I don’t know if I should create an API workflow or a recurring event or something else. Any help would be much obliged.

Hi there, @pshirole12… what you described should be pretty easy to do. First, create a backend workflow that takes a user as a parameter.

Then, add a step to the workflow that resets the user’s credits to 100.

Then, add a second step that schedules the backend workflow to run again 1 month from the current date/time.

Finally, add a step to your signup workflow that schedules the backend workflow to run 1 month from the current date/time.

Hope this helps.

Best…
Mike

1 Like

Thank you for the detailed explanation @mikeloc

1 Like

@mikeloc I have done exactly what you told me and it seems to have worked. One question I have is that when I set the Schedule API Workflow action after the Sign Up process (as shown by you in your last step/image), before that step, I still do need to “Make Changes to the User” and set the credits to 100 right?
As per my understanding, I set the user credits (make changes to the user) right after the sign up is done and then I add the schedule API workflow action. Is that correct?

Where you set up the database fields you can set the Credits to 100 by default, so on creation it already has the 100. Otherwise yes in the “Sign the user up” action you can set their credits to 100 there

1 Like

Yup, like Tyler said, I would definitely just set a default for the credits field like this.

1 Like

You might want to get the credits value from an option set that you set in your app. This means if you want to change the value you only have to change it once from the option set.

My app has a sort of credit limit, and I schedule workflows so that the limit is reset to Current user’s plan’s limit where the plan is an option which has the limit as a number attribute. This will make it easier for you to add paid plans that increase the limit in future

1 Like

Thank you for the idea! @georgecollier

Thanks, Mike. So no cron job needed? Never knew this

This topic was automatically closed after 70 days. New replies are no longer allowed.