/// <summary> /// Validates with the Apple store that the receipt for an iOS in-app purchase is valid and that it matches the purchased catalog item /// </summary> public static void ValidateIOSReceipt(ValidateIOSReceiptRequest request, ProcessApiCallback<ValidateIOSReceiptResult> resultCallback, ErrorCallback errorCallback, object customData = null) { if (_authKey == null) throw new Exception("Must be logged in to call this method"); string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy); Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer) { ResultContainer<ValidateIOSReceiptResult>.HandleResults(requestContainer, resultCallback, errorCallback, null); }; PlayFabHTTP.Post("/Client/ValidateIOSReceipt", serializedJson, "X-Authorization", _authKey, callback, request, customData); }
/// <summary> /// Validates with the Apple store that the receipt for an iOS in-app purchase is valid and that it matches the purchased catalog item /// </summary> public static void ValidateIOSReceipt(ValidateIOSReceiptRequest request, ValidateIOSReceiptCallback resultCallback, ErrorCallback errorCallback) { if (AuthKey == null) throw new Exception ("Must be logged in to call this method"); string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings); Action<string,string> callback = delegate(string responseStr, string errorStr) { ValidateIOSReceiptResult result = null; PlayFabError error = null; ResultContainer<ValidateIOSReceiptResult>.HandleResults(responseStr, errorStr, out result, out error); if(error != null && errorCallback != null) { errorCallback(error); } if(result != null) { if(resultCallback != null) { resultCallback(result); } } }; PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Client/ValidateIOSReceipt", serializedJSON, "X-Authorization", AuthKey, callback); }
/// <summary> /// Validates with the Apple store that the receipt for an iOS in-app purchase is valid and that it matches the purchased catalog item /// </summary> public static async Task<PlayFabResult<ValidateIOSReceiptResult>> ValidateIOSReceiptAsync(ValidateIOSReceiptRequest request) { if (AuthKey == null) throw new Exception ("Must be logged in to call this method"); object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/ValidateIOSReceipt", request, "X-Authorization", AuthKey); if(httpResult is PlayFabError) { PlayFabError error = (PlayFabError)httpResult; if (PlayFabSettings.GlobalErrorHandler != null) PlayFabSettings.GlobalErrorHandler(error); return new PlayFabResult<ValidateIOSReceiptResult> { Error = error, }; } string resultRawJson = (string)httpResult; var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); var resultData = serializer.Deserialize<PlayFabJsonSuccess<ValidateIOSReceiptResult>>(new JsonTextReader(new StringReader(resultRawJson))); ValidateIOSReceiptResult result = resultData.data; return new PlayFabResult<ValidateIOSReceiptResult> { Result = result }; }