I need help with the following scenario:
- User with userId x logs into my app, he is taken to the subscriptions page where he can choose from 3 offerings: monthly, 6 months and annual subscription. Let’s say he subscribes to the monthly. A webhook event is sent to my backend and now user with id x also shows with an active sub in my backend database.
- User with userid y logs into my app from the same store account as user x. Basically the same user with the same phone, same google/ios account but different application accounts. Now user y, does not have a sub so he is also taken to the subscription page and offered to subscribe to the same 3 offerings. If he chooses to purchase the same offering as the one that user x purchased, he will get an error saying that he cannot subscribe again to this offering. However, if he chooses a 6 months or annual offering, he is able to subscribe. A webhook event is sent to my backend and now user with id y also shows with an active subscription.
The problem here is that i am able to start another subscription if it’s of a different time period and the user will have 2 subscriptions started from the same store account.
Expected behaviour:
- When user with id y is taken to the subscriptions page in my app. He should not be able to purchase a new subscription since the underlying store account already has a subscription, no matter the time period. He should receive an error for all 3 offerings and have only the option to restore purchases from the user with id x.
Now taken into account the expected behaviour, how can i achieve this? From what I have seen there is no way to know if there is already a sub purchased with the underlying store account.
What is your advice to best handle this scenario?