I’ve read various similar threads and whilst they *almost* cover our situation, I can’t find a specific answer to the scenario we find ourselves in. Thanks in advance for any help anyone can offer and let me know if any clarification is needed on any points. Apologies for the length!!
- We have an app that will be used in schools where multiple devices may be used to sign in.
- Our app asks for account creation before it can be used.
- Once an account is created, the user can purchase a subscription to access content, either as part of that initial signup process, or by logging in at a later date and completing the process.
- We store no data to the device itself - all data is saved to our servers, so that a user can sign in on any device they have to hand once they have a subscription. A subscription buys you a login for a certain number of students and if the subscription expires, that login is revoked.
- We create our own unique ID during registration, that we pass to RevenueCat using the logIn() call and that is then saved to the user’s account in our backend, so we can link the two things up in the future.
- We are using Webhooks so that if a user uses a different device to manage their subscription, or makes a subscription change directly via their App Store account, we ensure their account on our servers is updated accordingly.
- We have set the RESTORE functionality to BLOCK RESTORE.
- The registration flow is:
- A. RevenueCat initialised with an Anonymous ID
- B. Sign up for an account with us (basic account data saved to our server)
- C. New RevenueCat ID created by us and used to logIn() to RevenueCat
- D. Purchase subscription
- E. Subscription choice saved to user record in our online database once success message received from RevenueCat
The bit I don’t understand is how we handle the following scenario… (examples using Apple App Store)
- A user signs up for an account with us, and purchases a subscription during that process. The unique ID we created for them and use when calling the logIn() function in RevenueCat (let’s call it RCID1) is assigned to both their RevenueCat account and their account with us. All good.
- At a later date, the same person signs up for a second account with us (maybe they forgot they had one, or thought the way to restart an expired account was to sign up from scratch)
- During this process, a second unique ID (RCID2) will have been created by us (because at that point we don’t know they’re the same person, as they aren’t signed in) and we will have passed RCID2 when logging in to RevenueCat via the logIn() call.
This is where I get confused.
At what point does RevenueCat realise that the user is trying to use the same Apple ID that was used when the original purchase was made? I’m assuming it’s when we make the purchasePackage call (we are using Unity). Step D in the above list. Is that correct?
If it is at that point, then I assume we will see a RECEIPT_ALREADY_IN_USE error returned?
BUT - my understanding is that even if we do receive a RECEIPT_ALREADY_IN_USE error, the subscription will still have been processed by Apple, and RevenueCat, and assigned to RCID1, so if they were trying to buy a different subscription, the existing account would be renewed / upgraded / downgraded accordingly?
Is that all correct?
Is there a way of asking the user to log in to their Apple account during the process before they try to subscribe, thereby bringing back the RevenueCat data associated with any previous purchases and flagging up at that point that the person who owns that Apple account already has a subscription?
Apologies for the long explanation. I feel like my brain is about to explode with all the possible scenarios involving different devices, different App Store accounts and different users!! Because we’re working with schools, there is every chance different people will be using the same devices and possibly signing in and out of different Apple accounts on those same devices, so we need to have a watertight approach where only one account can be linked to one Apple ID and that is linked to one RevenueCat ID too.