We are having a very strange behaviour with Unity IAP and Unity 2021.
Let’s say that I build a completely new App on a device from Xcode (so I’m deleting any previous version of the app on that device before compiling and running this new build).
I perform a consumable or non-consumable purchase and I close the App.
When I re-launch the App, I see that the ProcessPurchase method is called during the storeController initialization, for each non-consumable product already purchased by the user.
Now I close the App and re-launch it again and ProcessPurchase is no longer called automatically.
Note: This doesn’t happen on Android.
A few questions:
Is this the expected behaviour?
How can I understand if the ProcessPurchase has been called from a real user purchase or from this automated thing?
Why only after user purchased something during the previous session? this is completely useless… it would be very useful to get this behaviour at the very first launch of the App, so that we could use it as a restore purchases.
From your documentation I read:
“On Apple platforms users must enter their password to retrieve previous transactions so your application must provide users with a button letting them do so. During this process the ProcessPurchase method of your IStoreListener will be invoked for any items the user already owns.” but it seems I’m not seeing this behaviour… and again, I’m not triggering the restore in any way. Is this still a valid information?
Yes, this is an issue we are aware of, and working on. No ETA yet, but it’s high priority for us. Restore should not happen automatically on iOS, and you should receive only one ProcessPurchase for each product during the restore.
Do you recommend to handle this behaviour on our side (I’ve found a quick solution to just disregard any attempt of “unwanted automated restore”) or should we jump to a previous version of the package? and in this case could you indicate a version that wasn’t affected by this issue?
Can you describe your workaround? How do you tell in ProcessPurchase that this isn’t a duplicate or unanticipated call? We can’t recommend an earlier version as the stores likely wouldn’t accept it.
I’m not aware of the “duplicate” case. About the unanticipated one: to be sure that the ProcessPurchase has been called after a user purchase, I’m just handling a variable (currentProductID) that I fill with the name of the product ID that the user is purchasing and, inside the ProcessPurchase, I’m checking if the product received is equal to “currentProductID”. In any case I’m marking the purchase as “completed”. Not sure if this is the best way to handle this issue…it seems to work properly for our architecture.
I have just tested with IAP 4.0.3 and no longer see this issue on iOS. I created a (new) non-consumable, made a purchase, reinstalled and didn’t see a ProcessPurchase during IAP initialization during launch