App with multiple User in Single Device - Inapp Billing Subscription

后端 未结 2 1402
-上瘾入骨i
-上瘾入骨i 2021-02-07 18:30

I am developing an application with subscription feature using Inapp Billing v3.There is login mechanism to access the application. If a user \'X\' subscribes to a feature and l

2条回答
  •  花落未央
    2021-02-07 19:07

    Google Play in-app billing subscription is bound to Google Play account. So as long and Google account is not changed the subscription is considered valid for this account and you cannot purchase it one more time.

    If you want to substitute Google account system with your own accounts you need to "cheat" Google Play. What you can do is to create a pool of several different in-app billing subscriptions (like subscription #1, subscription #2, etc). When you subscribe you pass your own login as an additional parameter in developerPayload field.

    Now when you enumerate all available subscriptions you check if there is one with current user account in the developerPayload field. If not, then you consider that current user has no subscription and allow to subscribe using the first not used yet subscription from the pool of subscriptions (subscription #1, subscription #2, etc) you generated. Just make sure that there is number of subscriptions in your pool is bigger than number of users on the same device you could have.

    It is not a straightforward way, but rather a cheat to find a workaround for your situation.

提交回复
热议问题