[Solved] GooglePlayTangle.Data() error

Would anyone know why GooglePlayTangle.Data() is throwing these errors:

Assets/Purchaser.cs(258,79): error CS0103: The name `GooglePlayTangle’ does not exist in the current context

Assets/Purchaser.cs(259,58): error CS1502: The best overloaded method match for `UnityEngine.Purchasing.Security.CrossPlatformValidator.CrossPlatformValidator(byte[ ], byte[ ], string)’ has some invalid arguments

Assets/Purchaser.cs(259,58): error CS1503: Argument #1' cannot convert object’ expression to type `byte[ ]’

    public PurchaseProcessingResult ReceiptCheck (PurchaseEventArgs e)
    {
        #if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
        CrossPlatformValidator validator = new CrossPlatformValidator(GooglePlayTangle.Data(), // 258
        AppleTangle.Data(), Application.bundleIdentifier);   // 259

        try {
            // On Google Play, result has a single product ID.
            // On Apple stores, receipts contain multiple products.
            var result = validator.Validate(e.purchasedProduct.receipt);
            // For informational purposes, we list the receipt(s)
            Debug.Log("Receipt is valid. Contents:");
            foreach (IPurchaseReceipt productReceipt in result) {
                Debug.Log(productReceipt.productID);
                Debug.Log(productReceipt.purchaseDate);
                Debug.Log(productReceipt.transactionID);
        }
        } catch (IAPSecurityException) {
            Debug.Log("Invalid receipt, not unlocking content");
        }

        return PurchaseProcessingResult.Complete;

        #endif
    }

@gegagome

I know you mentioned this error in another thread also:

Were you able to get this issue resolved or are you still getting these errors?

This is what I did:
CrossPlatformValidator validator = new CrossPlatformValidator (null, AppleTangle.Data (), Application.bundleIdentifier);

But I doubt this would work for Android. For now I need iOS IAP but very soon I will need Google Play IAP so I don’t know what to do.

Thanks

@gegagome

The first parameter shouldn’t be null. It should have the GooglePlayTangle.Data(). The process for obfuscating your keys is described in the Manual. For Google, you will need your API key from the Google Play Developer Console.

@ap-unity

When I added GooglePlayTangle.Data() back in I got that parameter highlighted in fuchsia and the following error in the contextual hover in monodevelop:
error CS0103: The name GooglePlayTangle does not exist in the current context.

But when I run the editor no error is shown and was able to build successfully.

CrossPlatformValidator validator = new CrossPlatformValidator (GooglePlayTangle.Data(), AppleTangle.Data (), Application.bundleIdentifier);