[Closed] How to use CrossPlatformValidator: ProcessPurchase()?

Hello all! I’m building an android game and I’m trying to validate in app purchase receipts from google play.
I have a couple of questions regarding this, please do help if you can answer them.

When attempting this, I encountered this problem.

  1. After obfuscating, I got two new scripts as mentioned in the docs. However, in the script below, GooglePlayTangle is marked red in monodevelop and when my mouse hovered on top of it, it displayed that “it does not exist in current context”. Surprisingly, there was no error thrown in Unity Editor.
var validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.identifier);

Also, since validation is done inside of ProcessPurchase(), will there be any issues running this at Start() to check if player has made purchases? Or is there another function I am not aware of for this particular use?

I just read this:

On platforms that support it (e.g. Google Play and Universal Windows Applications) Unity IAP automatically restores any products the user owns during the first initialization following reinstallation; the ProcessPurchase method of your IStoreListener will be called for each owned item.

Docs: Unity - Manual: Restoring Transactions

What if the user had refunded the non-consumable product, and the app was not reinstalled?
Is this check done every time initialization is done? or only when the app is reinstalled?

If I would like to check every time the app starts, is m_StoreController.products.WithID(productID).hasReceipt reliable to do this job? I’ve read else where that this method may cause problems.:face_with_spiral_eyes:

@LandonC I would need to check this. Are you able to valid receipts during the normal ProcessPurchase flow?

Hi! Thanks for replying! I’m still testing at the moment, the “it does not exist in current context” error I mentioned above has disappeared once I restarted my computer. Strange.

I found a related question here, however it does not seemed to point to a solid solution.

Anyway, I’m still going to test hasReceipt for my next test since there is no other suggestion.