Ionic in-app purchase with multiple accounts in app

南楼画角 提交于 2020-01-06 06:18:27

问题


I've a question about in-app purchase subscription. In my app you can create multiple account. this is an example of my problem.

Login paolo.rossi@gmail.com and buy premium,
Logout paolo.rossi@gmail.com
Login paolo.verdi@gmail.com
I've already premium and I can't buy

How to solve this? In many app you can buy premium in the same phone with different account. is it a ionic limitation?


回答1:


I cannot answer how to achieve this in Iconic but this is the general approach I used in Android.

So the idea is to use your own back-end server to do two things:

1: Verify the payment details from your server with the Google. (This prevents hacking apps like Freedom)

2: Use your server to deliver the content and verify expiry.

The approach would be:

  1. Login paolo.rossi@gmail.com and buy premium (Send payment data to your server and verify with the Google/Apple that the payment is valid and not a fraud. After successful verification, the server sends subscription data like userId and expiry time to the app. The app should store this data in the local storage)
  2. Logout paolo.rossi@gmail.com.(Remove subscription details from the local storage)
  3. Login paolo.verdi@gmail.com. (On login send a request to your server "Does this person has a premium subscription?" since Verdi does not have the subscription the server should send a negative response.)
  4. The app shows you don't have the premium subscription. And Verdi can buy it.

So basically we bound the userId with the subscription and used our own server to verify the subscription.

Hope this helps somebody.



来源:https://stackoverflow.com/questions/54138528/ionic-in-app-purchase-with-multiple-accounts-in-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!