IAP behavior when user has to agree to new Apple Terms and Conditions during purchase.

Hi.
I have been unable to successfully test a purchase of a non-consumable on IOS when the user has to agree to new Apple Terms and Conditions first during the purchase process. After agreeing to the terms and conditions the user is informed by Apple that the purchase was successfully completed. However, Unity IAP received a Failure with Reason UNKNOWN (in OnPurchaseFailed).
It is not until the app is restarted that the ProcessPurchase function is called and the app acknowledges the
purchase (and removes ads in my case).

To test this I am using a sandbox user with the option checked to Interrupt Purchase. This causes the message to be displayed to the user about reading the Terms and Conditions first before proceeding with the purchase. As soon as the user agrees onPurchaseFailed is called with an UNKNOWN reason.

There does not appear to be a way to force the successful result to be returned to ProcessPurchase without restarting the app.

I have tried the following so far.

  1. Recalling Initialize function to force the purchase through without rebooting. Based on other threads this is not recommended and doesn’t appear to work any way.

  2. Restarting the scene instead of the whole app. This does call start() and subsequently initialize but does not cause processPurchase to be called.

  3. Informing the user that they must restart the app for their purchase to work. This has multiple issues including that I only have an UNKNOWN reason, so I don’t really know whether this was caused by Terms and Conditions. The average user doesn’t know how to restart and app and it is hardly a seamless approach.

  4. Using OnDeferredPurchase (in IAP 4.0.0) by registering it as a callback function. I could not get this is trigger in the case of an interruption caused by agreeing to Terms and Conditions. This appears to be for Ask To Buy functionality where a parent approves a child’s request to purchase.

So now I’m at a standstill. Does anyone have any suggestions on how to approach this?

Much appreciated.

@lopupafr Your testing approach looks correct, and your conclusions may be correct too. We will need to test. There indeed may be a iOS error code that we map to UNKNOWN as you’ve observed. The PurchaseFailed is expected from Apple. And the fact that subsequent ProcessPurchase isn’t also sent right away may be a limitation from Apple. But you are correct, the messaging to the user would be completely different for the Terms and Conditions vs an actual purchase failure.

Hi Jeff.
Thanks for the update.
If there is anything I can do to help you reproduce please let me know.

I did notice the following error messages were returned under these conditions:

1: User immediately hits cancel after Apple Purchase button appears: Returns Failed with UserCancelled.
2: User signs in to sandbox account, gets Terms and Conditions and hits CANCEL: Returns Failed with Unknown.
3: User signs in to sandbox account, get Terms and Conditions and AGREES: Still returns Fails with Unknown.
(But case three will also call processPurchase after the app is restarted).

I thought perhaps I could check for the presence of the receipt in case 3, but it doesn’t appear until after the restart, so I couldn’t not differentiate between 2 and 3 in the code.

If there was a way to distinguish between case 2 and 3 somehow, as a workaround I could ask the user to restart with a QUIT button that calls Application.Quit and have them relaunch. A bit messy :slight_smile:

Lo.

@lopupafr I have been able to reproduce with IAP 4.0.3 and I’m seeing the same behavior as you. I have let the engineering team know and hopefully get this addressed in an upcoming release.

Thank you, Jeff.
Much appreciated.