public void OnPurchaseFailed(Product product, PurchaseFailureReason p) { Debug.Log(string.Format("IAP::OnPurchaseFailed PurchaseFailureReason:{0}", p)); int purchaseType = 0; string udid = ""; #if UNITY_IOS || UNITY_IPHONE purchaseType = 1; //Apple Store EPlatformType.EPlatformType_AppStore udid = IOSUtil.iosGetOpenUDID(); #elif UNITY_ANDROID purchaseType = 2; //Google Play EPlatformType.EPlatformType_GooglePlay udid = AndroidUtil.GetOpenUDID(); #endif var transactionID = product.transactionID; var pid = product.definition.id; //Write cache FileBilling.Instance.ReadFile(); FileBilling.CReceiptInfo entry = new FileBilling.CReceiptInfo(); entry.RoleId = _roleId; entry.ProductId = pid; entry.BillingType = purchaseType; entry.IsSucceed = false; entry.TransactionId = transactionID; FileBilling.Instance.Update(purchaseType, entry); FileBilling.Instance.WriteFile(); PostVerifyData(_roleId, _roleId, purchaseType, pid, transactionID, udid, "", "", false, false); // Callback PURCHASE_INFO info = new PURCHASE_INFO(); info.iBillingType = purchaseType; info.strTransactionId = product.transactionID; _fnPurchaseCallback(false, info); }
// UDID public static string GetOpenUDID() { string udid = string.Empty; #if UNITY_IOS udid = IOSUtil.iosGetOpenUDID(); #elif UNITY_ANDROID udid = AndroidUtil.GetOpenUDID(); #endif if (string.IsNullOrEmpty(udid)) { udid = SystemInfo.deviceUniqueIdentifier; } return(udid); }