- Home /
Confim pending purchases using Unity In-App Purchases service
Greetings,
I am currently migrating a game from Unity 4 to Unity 5. I was using a plugin for in-app purchases before, but now I am migrating to Unity's in-app purchasing service.
The issue is that, according to Unity's documentation, when your IStoreListener
is instructed to process a purchase, it can return PurchaseProcessingResult.Pending
, so you can validate the purchase with your own server. It's not clear to me what happens with those pending purchases until they are verified. The documentation of the pending state says:
Unity IAP should continue to send the application notifications about this transaction when it starts.
(https://docs.unity3d.com/ScriptReference/Purchasing.PurchaseProcessingResult.Pending.html)
So, if I have pending purchases, I would expect to receive new calls to ProcessPurchase
next time I call UnityPurchasing.Initialize
. But it's not happening.
I can't find a way to force a "refresh" of the pending requests. Does anyone know how to do it?
Thanks in advance.
Answer by rmassanet · Jul 28, 2016 at 01:32 PM
Solved!
I'm posting this answer in case any one finds this question, having the same problem.
In my case, I just had to reimport the Unity IAP package. To do that, open the Services window, click on In-App Purchasing, and then click Import.
Upgrading Unity did not solve this, as the package binaries are in the project and are not a part of the engine, at this moment.
Also, it is not clear to me what the problem was. Reading through the package's changelog, I can't find any fix that affects both Android and iOS. There is a fix for iOS, that could be causing the problem I described, but it doesn't say anything about Android.
Answer by Banderous · Jul 27, 2016 at 06:23 PM
Are you restarting your Application or just calling Initialize within the same process lifetime? You need to restart the App for ProcessPurchase to be called again.
I tried both, and none of them causes ProcessPurchase
to be called again.
I see that Unity has fixed this in version 5.3.6. I don't know when they broke it. I was using 5.3.5 and it was not working.
Actually, they haven't. I'm still not receiving calls to ProcessPurchase
.
Please attach a trace from the device in question, starting from when your application starts and Unity IAP is initialised.