How to check subscription on app start`?


#1

Hi Guys,

i really enjoy devloping ionic 2 app.

But at the moment i have some problems with my purchase process:

How do i check if the user have a valid purchase, when the app starts?
I want to archive the following behavior:

User have subsription: -> show page a
User dont have subsription: -> show page b

Do i have to save the subsription local? Or whats the best way to do this?

Another question:
Whats the best way to emulate the subscription with “ionic serve”?

Hope someone can help me :slight_smile:

Thanks a lot!


#2

That’s a really difficult question with a myriad of different answers ranging from relatively simple to pretty complex, depending on how seriously you want to take things. The first questions that come to mind are:

  • Are you OK with end-users faking out the system and tricking the app into believing it’s been authorized?

  • Are you using this subscription state to allow/deny access to online content, or only to functionality completely contained within the app binary?

  • For that matter, do you have an online backend service at all?


#3

Hi,

sounds complex.

Iam using firebase and the service is only used within the app. However if there is a firebase based solution it would be a blast.

I think its ok for me if the user faking out the system. If the user dont pay for an product he wont do it anyway.

My idea is: I could save the subscription to firebase, but how do i check it after a month? or two?


#4

You could use the restorePurchases method to get the state of purchases.