[Solved] Unity IAP calling ProcessPurchase for same product two times

Guys, when I’m buying a CONSUMABLE PRODUCT using Unity IAP on Android, the ProcessPurchase method is being called twice.

This started to happens today. It’s odd because our old builds (from June 2017) are being affected too (using an old Unity Version and old UnityIAP version). This never happened before. It only happens on Android.

The transaction id and payload are both equal. The Unity is calling the ProcessPurchase one after another.

Environment:
Platform: Android
Unity Version: 5.6.1p2
Unity IAP Version: 1.13.1 and prior versions

Seeing the same thing in older unmodified Android app.
Does the Unity IAP talk to some Unity backend that perhaps is borked or is this a google thing?

Good question.

Waiting for feedback from Unity Team.

We are not seeing this behavior in Beta/Alpha testing. Can you confirm this only occurs with actual purchases?

We reproduced the issue with a sandbox purchase (android) as well this morning (again - with older app that was working fine the day before yesterday) - using
5.6.1f1 and IAP [1.11.2]

Which Android version are you using?

“Android OS 7.0 / API-24 (NRD90M/G955FXXU1AQH3)”
It’s a Samsung Galaxy S8+ device (the one we reproduced this morning)

In fact both users seeing the issue are Galaxy S8 and Android 7.0

Hi,

Two users reported this to us, so they are not using sandbox.

Our versions are the one reported by gilberto-lumentech.

Also it is an odd behaviour, sometimes the first purchase is correct(calls ProcessPurchase only once), but afterwards it calls always two times. We saw this buying consumables with users that already had non-consumables and with users that did not. It is pretty straight forward to occour and we traced this happening up to builds we did 3 months ago, we didn’t want to go much far than that.

In my case, It got even worst, the google play dialog bugged one time I was testing, instead of presenting the content of the IAP it presented crypted data, and after that, that item is stuck, everytime I try to buy it, it says that I already have it, although ProcessPurchase is never called for that item in my game, but I’m using sandbox.

Saw the exact same behavior in reproducing this with sandbox account

Since yesterday, we had more than one thousand duplicated purchases. They were real purchases (not sandbox ones).

If it helps - we are NOT using unity analytics nor are we using unity receipt validation.

@jamiel_mf Can you clarify? This thread is about the IAP ProcessPurchase callback being called twice for each purchase. Unity IAP requires Unity Analytics to be enabled.

Uhhh… I was basing that solely on the UCB project has an option to ‘enable analytics’ which I took to mean that it was disabled. Looks like our project DOES have analytics enabled. Is that communication with Unity perhaps the cause of the double ProcessPurchase invocation?

By the way - WHY does IAP require analytics to be turned on?

@jamiel_mf We are still investigating the double purchase issue. The services share code resources.

Exactly.
If I purchase consumable A, then the method is called twice. It does not happens always… It’s like 90% of the time.

Hi, same problem here, Huawei CAM-L2 Android 6.0, LG-D802 Android 5.0.2.
I cannot reproduce the error in an emulator like BlueStacks.
Of course we validate the receipt in the backend so there is no actual double purchase, just a silent error, but still, this doesn’t happens with iOS, I think.

09-20 17:16:30.097 10413-10413/? I/UnityIAP: NotifyUnityOfPurchase

That’s the line before the double call, if that helps.

Hi @gilberto_lumentech Thank you for reporting this and sharing all these details. I’ve not been able to reproduce this yet. I’ve not tested on 5.6.1x yet, however.

Are the double-purchases seen in log files on the device, or via external log files / analytics?

Which “payload” are you referring to in the first post of this thread?

Is there a complete device log-file you would be comfortable sharing with us which demonstrates this issue?

FYI we use the Google Play “orderId” primarily or “purchaseToken” secondarily for the Unity IAP “transactionId”.(Sandbox purchases no longer include orderId as of early 2016, so we use whichever is available.)

Hi @helton-lumentech thank you for this information. What sort of data was shown in the dialog? Was it garbage data? Or could it be a translation / localization?

@gilberto_lumentech , @jamiel_mf , @helton-lumentech , @posibillian_tech

According to reports on Google’s issue tracker, this may also be happening with outside of Unity IAP, so I think this may be a Google Play issue. That would also explain why it was happening to older builds of apps. It may be helpful to have the issue reported there:

https://issuetracker.google.com/issues/66054158

1 Like