Steven Coull Steven Coull - 1 month ago 15
iOS Question

Unity In-App Purchase Local Validation is slow

I'm currently changing our game's in-app purchasing model from an older add-in to unity's built-in service. Up until now there have been no issues testing payments and validating receipts, both live and using sandbox accounts.

Following the Unity guides I have developed a store, and can successfully make new payments with a sandbox account, however local validation takes around 2 minutes on an iPad Air 2. Is this normal? Our previous add-in validated receipt data using the App Store, and took only a few seconds.

private bool CheckReceipt()
{
#if UNITY_EDITOR
Debug.Log("IAP: Default for editor, receipt valid.");
return true;
#elif UNITY_ANDROID || UNITY_IOS
try
{
CrossPlatformValidator validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
AppleTangle.Data(), Application.bundleIdentifier);
Product product = controller.products.WithID(ProductID);
string receipt = product.receipt;
if (receipt == null)
{
Debug.Log("IAP: No receipt.");
return false;
}
Debug.Log("IAP: Validating receipt...");
IPurchaseReceipt[] result = validator.Validate(receipt);
return result[0].productID == ProductID;
}
catch (IAPSecurityException e)
{
Debug.Log("IAP: Invalid receipt, not unlocking content");
return false;
}
#endif
}

Answer

In mode "Sandbox" this time for validation very real, when you change paying to "Battle" mode all stand normal