Tutorial on how to make an account balance for each user

Hi. I’ve been searching for a tutorial on how to start a workflow to create an account balance for each user, which can be used for in-app purchases, but I can’t seem to find any.

Can anyone please enlighten me about it? Or maybe share a tutorial so I can grasp the concept and I’ll work from there.

I would describe it like this:

  1. All users start with zero balance, unless they purchase/top up. I can work out the terms/disclaimer and payment method for this. Say for example, 10,000 points for $1. Points conversion may be automated or manually (as a back up).
  2. There’s a list of in-app purchases that may change from time to time. (Not yet sure on how to update it from time to time.)
  3. Users may have to input how much points they want to consume and press a button to finalize the trade.
  4. The consumed points will be deducted from the user’s balance and get what he purchased.

Seems a little too advanced for a beginner like me. I would appreciate it very much if you can lead me to where I can get the idea and start working or share a knowledge perhaps.

At a very basic level (without understanding the details of your app), you could have a points_balance field on the User data type in your database. You could implement Stripe for payments and when a user pays for points, you simply add the number of points purchased to the points_balance for that user. When the user makes an in-app purchase, you deduct the points they used from the user’s points_balance.

There probably isn’t a tutorial for exactly the scenario you want, but there are many on retrieving and setting field values from/to the database.

Hope this helps.

1 Like

Make a field on the user called “balance” or something like that and give it type number.
Whenever the user does something that would change the balance, create a “make changes to thing” action and select the “current user” and add the “balance” field. Then add or subtract the right amount from the balance.

2 Likes

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