[Solved] Errors when products fail to be consumed

Hello!

We have a store using Unity’s IAP system that has been working fine so far, but now that our game is in QA we’re getting reports related to not handling correctly the different errors that can occur when there are problems executing the calls sent by Google when a product is being purchased.

The QA team has been using the Charles Proxy to use its breakpoints tool and interrupt the different kind of calls that Google sends during the purchase flow. These are the calls done after pressing the “Buy” button of the Google Play pop up or after the ConfirmPendingPurchase() method is used (the “commitPurchase” call would be one of them for example).

This generates different kind of errors such as causing a product to become unavailable for purchasing. When you try to purchase them again the error pop up that says “You already own this item” appears.

Sometimes I also get the following error log (I’ve hidden the code of the product so please disregard the sku identification):

08-29 18:18:42.402: I/UnityIAP(17019): Error consuming consuming sku com.xxx.xxx. 6:Error
08-29 18:18:42.403: I/UnityIAP(17019): onConsumeFinished:false
08-29 18:18:42.403: I/UnityIAP(17019): Error consuming sku sku com.xxx.xxx (response: 6:Error)
08-29 18:18:42.403: I/UnityIAP(17019): 6

We have tried to handle these errors when they occur, but we haven’t been able to find any event that is raised when the Unity IAP fails to consume the product.

My question is: does Unity IAP provide any event to catch and handle errors such as the ones described above? Especially in the case when the game fails to consume a product? The OnPurchaseFailed() event is either not called or is called but gives “Unknown” as a reason, which doesn’t give enough information in order to handle the issue.

Hi @ddiaza ,

Very sorry you’re experiencing this issue! As far as the Unknown failure error message, that is an issue that has been reported before, and we’re looking into ways we can address the issue and provide greater information about why its failing.

As far as the “You already own this item” erroneous message, are you on the most up to date version of IAP? There were some issues with apps being sent to the background during purchase, but they have been fixed in recent versions. This error should go away on app relaunch because consumption should be retried. If you’re on the most up to date version of IAP and you’re not experiencing this, can you post (or send in a support ticket if you’re not comfortable posting) the full debug logs from app launch to the attempted purchase?

Hi Erika!

I’m glad to hear that you’re already looking into the issue of the Unknown failure. I’ll be waiting to hear more on that later then.

As for the IAP version, I’m using version 1.7.0. I had wanted to avoid upgrading to version 1.8.1 since I’m close to a delivery date and from the changelog I didn’t get the impression that the update would help with the current issues that we’re dealing with. Would you still recommend to upgrade ASAP?

Thanks for the recommendation of using the Support Ticket. I’ll be sending you the full logs through that.

Hi @ddiaza ,

Thanks for filling out the support ticket, I see it came through! We will look at the logs and get back to you in regards to whether upgrading to the new IAP version is the right next step for you, given your near-release situation. :slight_smile: