Restore Purchase for subscription not working on iOS (IAP 4.5.2, Unity 2021.3.16f1)

I am getting an error when trying to restore purchases in iOS. The purchase of the (yearly renewable) subscription works fine. However once I delete the app, reinstall, and call Restore Purchase, Xcode spits out this error:

UnityIAP: restoreCompletedTransactionsFailedWithError
RestorePurchases continuing: False. If no further messages, no purchases available to restore.

However If I try to purchase the product through the original purchase button, I get an “You’re currently subscribed to this.” Message. So somewhere in the store Apple must have a record of this purchase…

This is my RestorePurchases method:

  public void RestorePurchases()
    {
        // If Purchasing has not yet been set up ...
        if (!IsInitialized())
        {
            // ... report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
            Debug.Log("RestorePurchases FAIL. Not initialized.");
            return;
        }

        // If we are running on an Apple device ... 
        if (Application.platform == RuntimePlatform.IPhonePlayer ||
            Application.platform == RuntimePlatform.OSXPlayer)
        {
            // ... begin restoring purchases
            Debug.Log("RestorePurchases started ...");

            // Fetch the Apple store-specific subsystem.
            var apple = storeExtensionProvider.GetExtension<IAppleExtensions>();
            // Begin the asynchronous process of restoring purchases. Expect a confirmation response in 
            // the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
            apple.RestoreTransactions((result) =>
            {
                // The first phase of restoration. If no more responses are received on ProcessPurchase then 
                // no purchases are available to be restored.
                Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
            });
        }
        // Otherwise ...
        else
        {
            // We are not running on an Apple device. No work is necessary to restore purchases.
            Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
        }
    }

—Some other info that may be pertinent:

I have a method that tries to get the user’s subscription status directly from Apple after the StoreListener has been initialized (soon after startup). This method works fine after initial purchase. However after I delete and reinstall the app, I get a No Receipt Found error.

I have tried calling RefreshAppReceipt, which seems to do something. Once I hard close and reopen the app, the store returns the subscription status correctly. However calling RefreshAppReceipt and then RestorePurchases as a callback from that does not work.

Any tips for getting RestorePurchases to work would be much appreciated!

Hello seidensj,

Are you testing this on Sandbox/TestFlight or is this on a live application?

I also noticed the restore callback doesn’t return the error message. I have created a ticket for us to improve this, but in the meantime, are you able to debug in xCode?
The file UnityPurchasing.m has a function restoreCompletedTransactionsFailedWithError which contains the error that would inform you of what went wrong with the restore purchase.

Also, you could try logging out from the app store and try logging back when prompted during the restore transaction.

i had same issue. I tried use appleExtensions.RefreshAppReceipt before restore but still error.
Environment : sandbox, testflight.
I tried to purchase the product through the original purchase button, I get an “You’re currently subscribed to this.”