[Unity] IAP.GetViewerPurchases() returns Platform error
Hello, I am facing a weird issue with my IAP in my testing account where every time, I try to fetch user purchases:
IAP.GetViewerPurchases().OnComplete(msg =>
{
if (msg.IsError)
{
Debug.Log($"Error: {msg.GetError().Message}"); //lands here every time
return;
}
//other code
}and this is error message:
OVRPlatform [Purchase] Purchase::deserialize: response object field "grant_time" was not a uint64. Value is: -120and my log message:
Error: Server response is not valid JSON.This started happening after my test subscription expired and I deleted the subscription from my dashboard.
-- UPDATE --
Same issue with `IAP.GetViewerPurchasesDurableCache()`
-- UPDATE 2 --
Looks like this problem is occurring with `IAP.LaunchCheckoutFlow` as well. In my opinion, this is likely a test account only issue but there is no way to confirm.
So I ended up creating a new test user and rightfully, the new test user was able to take all IAP related actions that is until it subscribed and then deleted the subscription from the dashboard. Here is the solution that I found: Don't "Delete" subscription from the dashboard as that seems to trigger this error. The correct way is to first "Cancel" and then "Expire" from the dashboard.
If for someone, this error is still occurring even after setting it to "Expired" state, then go to Development -> Test Users -> triple dot of your test user account -> Manage test credit cards -> switch to a different card as default . That seems to reset any subscription state for that test user and you can start fresh.
Crazy stuff!