Example #1
0
    public GooglePurchaseData(string receipt)
    {
        try {
            var purchaseReceipt = JsonUtility.FromJson <GooglePurchaseReceipt>(receipt);
            var purchasePayload = JsonUtility.FromJson <GooglePurchasePayload>(purchaseReceipt.Payload);
            var inAppJsonData   = JsonUtility.FromJson <GooglePurchaseJson>(purchasePayload.json);

            inAppPurchaseData  = purchasePayload.json;
            inAppDataSignature = purchasePayload.signature;
            data = inAppJsonData;
        } catch {
            Debug.Log("Could not parse receipt: " + receipt);
            inAppPurchaseData  = "";
            inAppDataSignature = "";
        }
    }
Example #2
0
 public GooglePurchaseData(string receipt)
 {
     try
     {
         GooglePurchaseReceipt googlePurchaseReceipt = JsonUtility.FromJson <GooglePurchaseReceipt>(receipt);
         GooglePurchasePayload googlePurchasePayload = JsonUtility.FromJson <GooglePurchasePayload>(googlePurchaseReceipt.Payload);
         GooglePurchaseJson    googlePurchaseJson    = JsonUtility.FromJson <GooglePurchaseJson>(googlePurchasePayload.json);
         inAppPurchaseData  = googlePurchasePayload.json;
         inAppDataSignature = googlePurchasePayload.signature;
         json = googlePurchaseJson;
     }
     catch
     {
         inAppPurchaseData  = string.Empty;
         inAppDataSignature = string.Empty;
     }
 }