On iOS, no Apple ID is signed in but ProcessPurchase is being called and I get a receipt

tl;dr: I am signed out of the iTunes App Store. Nonetheless, when I run the app, ProcessPurchase is called and I get a receipt.

What I did (these steps repeatably give the same undesirable result):

  • On my iOS testing device: open the Settings app, tap “iTunes & App Store”, and tap the Apple ID to sign out (unless I’m already signed out).

  • Delete and reinstall the app, power off the device just for good measure, turn on the device, and launch the app.

  • Confirm via debugging printouts that ProcessPurchase is being called during the startup process without my ever signing in again to the app store. It’s getting a receipt that includes a non-consumable purchase made in July 2018 and my app is activating the purchase accordingly. (That doesn’t seem cool; the app doesn’t know which of the various testing Apple IDs I’ll eventually sign in with, so it shouldn’t know which account’s receipt to get.)

  • The code returns PurchaseProcessingResult.Complete if the app gets this far. But when I repeat the steps, the same thing happens.

My questions are:

  • Why am I getting a receipt if there’s no one signed in? I’d think that it couldn’t happen because no one would know which user to ask iTunes about. I certainly wouldn’t want players getting this paid feature for free just by launching the app while not signed in.

  • We’ve released several times since the purchase was made last summer and haven’t observed this behavior in our releases from last summer until now. Did something change in the last 6 months to cause the new behavior? (We last tested and released in early June 2019.)

  • In previous releases we’d launch the app in a signed-out state and no non-consumable purchases wouldn’t be activated until the Restore Purchases button was clicked and the user signed in. At that point, if there was a non-consumable on the user’s account then the purchase was activated.

  • Is there a fix/workaround for this issue, or something I need to fix in our code?

Tech Specs:

  • iPhone 8
  • iOS 11.4.1
  • Unity version 2017.4.33f1 (also occurs in 2017.4.22f1)
  • Unity IAP version 1.19.0
  • All problematic builds were built with Unity Cloud Build. We first noticed it in a build created on 2019-12-16.

It sounds like you are seeing the auto-restore on iOS, this was addressed in the latest release 1.23.1. These users had already purchased before, and were signed onto the phone (not iTunes).

Thanks! We’ll look into 1.23.1.