I am using Unity IAP services in Unity v5.3.4p4 for Android.
I have implemented inapp purchases which seems to work fine except one bug. If internet connection goes off when the payment is being processed, then the state goes to an inconsistent state as it is unable to send the consume event internally, which I have checked in the log.
Now, since it is unable to consume that product, so if we try to buy that product again, it shows item is already owned by me. I have checked all the API and nowhere I have found a way to consume the product explicitly.
What should I do ?
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)
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/