Search code examples
androidionic-frameworkin-app-purchasecordova-pluginsionic4

How to remember the purchased credit in the ionic app implementation


I am new in the app development and this is something that I could not find enough information about so far. I am intending to implement an application in which I will have a table where each row includes some unique data (independent from other rows).

I would like to implement a credit mechanism where a user - e.g. - purchases 100 credits (via in-app purchases); and whenever s/he wants to see the content of a particular row in the table, s/he will need to spend - e.g. - 10 credits.

Example: In the beginning, the user has 0 credit. Then s/he buys 100 credits and then chooses to see the content of 3 rows in the table (each row costing 10 credits). And at the end, s/he still has 70 credits.

Targets I have:

  • I would like to implement this procedure without forcing the user to create a membership account. With other words, installing the app shall be enough to start buying credits without further registration.
  • I do not want to save the user credit information in a database to later be able to remember how many credits the user still has.
  • I want the mobile app to remember the amount of credit it has even if the user does not use the application for a while or restarts the mobile phone, etc.

I am implementing this app by using Ionic (Angular). Can this implementation be done as explained above (without a database for remembering the user credit info)? If no, why..? If yes, how can it be done?

Addendum: If you have experience/knowledge in developing such a functionality in a different way than how I described it above, you are welcome to share it as well.


Solution

  • yes you can store user's credit information in users mobiles using Ionic Offline Storage. Ionic Offline Storage is a cross-platform data storage system that works on iOS and Android.

    This simple documentation will help you for implementation

    NOTE: If user clear app storage/cache then already stored user data (e.g. credits) also gets cleared.