Search Unity

Ios Restore Processpurchase Fail

Discussion in 'iOS and tvOS' started by alexp96, Apr 15, 2019.

  1. alexp96

    alexp96

    Joined:
    Aug 30, 2018
    Posts:
    7
    Hello,

    I'm having an issue with the restore purchase, buying new products works fine, it initializes and the purchase is made successfully, however after removing and installing the application again, when I tap the restore button i get the error: ProcessPurchase: FAIL. Unrecognized product: "productID"

    Promo interface is available for the correct number of items.

    I'm using the code provided by Unity and I cannot understand why this is happening, please help.


    Code (CSharp):
    1. public void RestorePurchases()
    2.     {
    3.         // If Purchasing has not yet been set up ...
    4.         if (!IsInitialized())
    5.         {
    6.             // ... report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
    7.             Debug.Log("RestorePurchases FAIL. Not initialized.");
    8.             return;
    9.         }
    10.  
    11.         // If we are running on an Apple device ...
    12.         if (Application.platform == RuntimePlatform.IPhonePlayer ||
    13.             Application.platform == RuntimePlatform.OSXPlayer)
    14.         {
    15.             // ... begin restoring purchases
    16.             Debug.Log("RestorePurchases started ...");
    17.  
    18.             // Fetch the Apple store-specific subsystem.
    19.             var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions>();
    20.             // Begin the asynchronous process of restoring purchases. Expect a confirmation response in
    21.             // the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
    22.             apple.RestoreTransactions((result) => {
    23.                 // The first phase of restoration. If no more responses are received on ProcessPurchase then
    24.                 // no purchases are available to be restored.
    25.                 Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
    26.             });
    27.         }
    28.         // Otherwise ...
    29.         else
    30.         {
    31.             // We are not running on an Apple device. No work is necessary to restore purchases.
    32.             Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
    33.         }
    34.     }
    35.