To reproduce:
Purchase a product. After confirming the payment in Google Play popup, cut the connection or force close the app. Reopen the app and let it initialize Unity IAP.
It does not persist forever but there’s no way to handle it, which I believe is unacceptable for any production app:(
Edit: After initialization no longer fails, it may start to say Product Unavailable whenever we tries to purchase something. It behaves normal again after Google Play automatically refund.
Sorry, what does not persist forever? Can you be more specific in the issue that you are seeing? Do you see the error when you restart? Are you receiving ProcessPurchase before you quit the app?
We have a backend server to validate every transaction so we always return PurchaseProcessingResult.Pending when Unity IAP ask ProcessPurchase. We call Controller.ConfirmPendingPurchase when the server finish its validation.
→ I made sure GooglePlay execute the transaction but not consuming it before I quit the app.
→ The exeption happens within UnityPurchasing.Initialize();
The exception always happens until Google Play automatically refund the charge.
I am not able to reproduce. Please use the Sample IAP Project and provide specific steps to reproduce without a server. So you return Pending from ProcessPurchase then quit the app? I don’t see any issue when I do that Sample IAP Project
What if it’s interrupted before the first ProcessPurchase returns anything?
Anyway, what concerns me most here is it’s a MethodAccessException, would you mind offering some insight what could incur a MethodAccessException when UnityIAP initialize?