publicasyncTaskBuyStoreItem(EconomyListStoreItemstoreItem){if(string.IsNullOrEmpty(storeItem.Cost.Sku)){IEconomyPurchaseAckresult=await_economySystem.PurchaseStoreItemAsync(storeItem.Id);// Show reward animation UI.ShowRewardAnimationUI(result.Reward);// Your custom function.}else{try{varresult=await_unityPurchasingSystem.BuyProductByIdAsync(storeItem.Id);AnalyticsSendReceipt(result.receipt);// Your custom function.// Show reward animation UI.ShowRewardAnimationUI(storeItem.Reward);// Your custom function.}catch(PurchaseFailureExceptione){switch(e.Reason){caseUnityEngine.Purchasing.PurchaseFailureReason.UserCancelled:// Popup some UI.break;caseUnityEngine.Purchasing.PurchaseFailureReason.PaymentDeclined:// Popup some UI.break;caseUnityEngine.Purchasing.PurchaseFailureReason.ExistingPurchasePending:// Popup some UI.break;caseUnityEngine.Purchasing.PurchaseFailureReason.PurchasingUnavailable:caseUnityEngine.Purchasing.PurchaseFailureReason.ProductUnavailable:caseUnityEngine.Purchasing.PurchaseFailureReason.SignatureInvalid:caseUnityEngine.Purchasing.PurchaseFailureReason.DuplicateTransaction:caseUnityEngine.Purchasing.PurchaseFailureReason.Unknown:break;}}}}