CrossPlatformValidator throws an InvalidSignatureException when buying google product items.
Logcat -
IPurchaseReceipt CrossPlatformValidator {“Store”:“GooglePlay”,“TransactionID”:“pekcjpebampnfholknaehheb.AO-…-Sx8mJ5…”,“Payload”:"{"json":"{\"orderId\":\"GPA.3350-1000-4525-
IPurchaseReceipt IAPSecurityException UnityEngine.Purchasing.Security.InvalidSignatureException: Exception of type ‘UnityEngine.Purchasing.Security.InvalidSignatureException’ was thrown.
at UnityEngine.Purchasing.Security.GooglePlayValidator.Validate (System.String receipt, System.String signature) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.Security.CrossPlatformValidator.Validate (System.String unityIAPReceipt) [0x00000] in <00000000000000000000000000000000>:0
at IAPManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs args) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product) [0x00000] in <00000000000000000000000000000000>:0
at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <00000000000000000000000000000000>:0
IAPManager:processPurchase(PurchaseEven
Code -
#if IAP_VALIDATOR
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
bool t_IsBuy = true;
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
var validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.identifier);
try
{
Debug.LogFormat("IPurchaseReceipt identifier {0}", Application.identifier);
Debug.LogFormat("IPurchaseReceipt CrossPlatformValidator {0}", args.purchasedProduct.receipt);
var result = validator.Validate(args.purchasedProduct.receipt);
Debug.LogFormat("IPurchaseReceipt CrossPlatformValidator 2");
string productid = "";
foreach (IPurchaseReceipt productReceipt in result)
{
Analytics.Transaction(productReceipt.productID, args.purchasedProduct.metadata.localizedPrice, args.purchasedProduct.metadata.isoCurrencyCode, productReceipt.transactionID, null);
Debug.LogFormat("IPurchaseReceipt {0} {1}", productReceipt.productID, args.purchasedProduct.metadata.localizedPrice);
if (String.Equals(productReceipt.productID, productid))
{
t_IsBuy = true;
}
}
}
catch (IAPSecurityException e)
{
t_IsBuy = false;
Debug.LogFormat("IPurchaseReceipt IAPSecurityException {0} {1} {2}", e.Message, e.InnerException, e.Data);
Debug.LogFormat("IPurchaseReceipt IAPSecurityException {0}", e);
//CallMessageBox("Invalid receipt, not unlocking content IAPSecurityException");
}
#endif
Environment:
Unity 2019.2.20f1
Unity IAP 2.0.6