Привет! Я применил AppPurchase к своему приложению, использующему формы xamarin, и мое приложение в порядке отправки квитанции Google на моем сервере (azure).
Но при получении StatusCode: 400, ошибка BadRequest при отправке Apple Receipt.
Вот мой код:
public async Task<PurchaseResult> PurchaseAsync(AppleReceipt receipt)
{
switch (Device.RuntimePlatform)
{
case Device.iOS:
devicePlatform = "ios";
break;
case Device.Android:
devicePlatform = "android";
break;
}
client.DefaultRequestHeaders.Add("deviceplatform", devicePlatform);
client.DefaultRequestHeaders.Add("serviceid", serviceId);
InitializeApiClientUser(true);
client.BaseAddress = new Uri($"{Constants.ApiUrl}purchaseapple{codePrefix}{Constants.ApiKey}");
var s = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat };
HttpResponseMessage response = await client.PostAsJsonAsync(client.BaseAddress, receipt);
CocoSharpControlUI.DisplayAlert("RESPONSE", response.ToString());
client = new HttpClient();
return JsonConvert.DeserializeObject<PurchaseResult>(await response.Content.ReadAsStringAsync());
}