Unity IAP services 5.3.1p3 consuming already owned items if internet goes off while transaction is processing

Hi,

I am using Unity 5.3 and using Unity IAP services.

Everything seems to be working fine, but when internet goes away while doing a transaction, it seems like consuming event for that product ID is not getting called due to which if we try to buy that item again, it shows item already owned.

I am using all my products as consumable.

So, is there any way to consume the item explicitly if not present in the unity IAP API

I assume this is in reference to Google Play. If consumption fails due to lack of Internet, Unity IAP will automatically attempt consumption again if another purchase is attempted, or on next startup.

If you want to trigger a consumption before this point you can call IStoreController.ConfirmPendingPurchase

We have integrated UnityIAP using Unity5.4.2f2. If the “PurchaseProcessingResult” does not return anything due to a lost connection the purchased item is lost. It will not be restored on next startup as pending item. We assumed that UnityIAP comsumes the item in case this happens, but in the GoogleStore the item is not consumed. This is what is causing this error.
We are not able to react to the error “ItemAlreadyOwned” because the fail reason when we try to rebuy the package is “UserCanceled” as if everything was fine and the user actually aborted the purchase.
Any updates from Unity would be highly appreciated!

It’s 2019 and i am still encountering this issue. My problem is the same as @TheArchitect42

For resolving the bug, you need to edit the OnInitialized function as follows:

    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    {
        // Purchasing has succeeded initializing. Collect our Purchasing references.
        // Overall Purchasing system, configured with products for this application.
        m_StoreController = controller;
        // Store specific subsystem, for accessing device-specific store features.
        m_StoreExtensionProvider = extensions;

        foreach (var product in m_StoreController.products.all)
        {
            m_StoreController.ConfirmPendingPurchase(product);
        }
    }

Using the above lines of code, the ProcessPurchase function would be invoked automatically for the purchases that are still pending.
For more information, check http://codesaying.com/unity-iap-stuck/