title: Unity IAP receipt validation
body: <p>I have made a project with Unity (2019.4) in my project user can buy product with In App Purchase.</p>
  <p>I used codeless IAP Manager and use receipt validation to validate purchases.</p>
  <p>In android I've no problem. But in IOS jailbroken phone can buy product with fake payment</p>
  <p>here is my code sample</p>
  <pre><code>public void OnPurchaseComplete(Product product)
      {
      var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
      AppleTangle.Data(), Application.identifier);
  
      bool ValidPurchase = false;
  
      try
      {
          // On Google Play, result has a single product ID.
          // On Apple stores, receipts contain multiple products.
          var result = validator.Validate(product.receipt);
          // For informational purposes, we list the receipt(s)
          Debug.Log(&quot;Receipt is valid. Contents:&quot;);
  
  
          
          foreach (IPurchaseReceipt productReceipt in result)
          {
              Debug.Log(productReceipt.productID);
              Debug.Log(productReceipt.purchaseDate);
              Debug.Log(productReceipt.transactionID);
              
              
              GooglePlayReceipt google = productReceipt as GooglePlayReceipt;
              if (null != google)
              {
                  // This is Google's Order ID.
                  // Note that it is null when testing in the sandbox
                  // because Google's sandbox does not provide Order IDs.
                  ValidPurchase = true;
  
                  Debug.Log(&quot; google transaction&quot; + google.transactionID);
                  Debug.Log(&quot; google transaction&quot; + google.purchaseState);
                  Debug.Log(&quot; google transaction&quot; + google.purchaseToken);
              }
  
              AppleInAppPurchaseReceipt apple = productReceipt as AppleInAppPurchaseReceipt;
              if (null != apple)
              {
                  ValidPurchase = true;
                  Debug.Log(&quot; apple transaction1&quot; + apple.originalTransactionIdentifier);
                  Debug.Log(&quot; apple transaction2&quot; + apple.subscriptionExpirationDate);
                  Debug.Log(&quot; apple transaction3&quot; + apple.cancellationDate);
                  Debug.Log(&quot; apple transaction4&quot; + apple.quantity);
              }
          }
  
          
  
      }
      catch (IAPSecurityException)
      {
          Debug.Log(&quot;Invalid receipt, not unlocking content&quot;);
          ValidPurchase = false;
      }
      //product.receipt;
      if (ValidPurchase)
      {
          //successfull
      }
  } 
  </code></pre>
  <p>What should I do to protect from jailbroken iPhone.</p>