Purchases.Voidedpurchases.List 返回空响应

时间:2021-04-07 00:09:14

标签: c# google-api google-play google-api-dotnet-client in-app

我正在请求 google Android Publisher api 检查我的申请中已作废的购买。问题是响应始终为空(代码为 200)。我有一些在 30 天内退款的购买。我尝试使用 C# android Publisher nuget 包并使用邮递员手动发出此请求。结果是成功但为空。

        string           contents   = await File.ReadAllTextAsync("D:/Projects/android-publisher-api-key.json");
        GoogleCredential credential = GoogleCredential.FromJson(contents);

        string[] scopes = { AndroidPublisherService.Scope.Androidpublisher };

        credential = credential.CreateScoped(scopes);

        BaseClientService.Initializer initializer = new BaseClientService.Initializer
        {
            HttpClientInitializer = credential,
            ApplicationName       = "Test App"
        };

        AndroidPublisherService androidPublisherService = new AndroidPublisherService(initializer);

        var request  = androidPublisherService.Purchases.Voidedpurchases.List("com.MyCompany.MyTestApp");
        var response = await request.ExecuteAsync(); // In this response all fields are null

我使用邮递员向(使用bearerToken)发送请求: https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.MyCompany.MyTestApp/purchases/voidedpurchases

响应为成功 200,但正文仅包含 {}。它至少应该具有 documentation 中列出的结构。

1 个答案:

答案 0 :(得分:1)

我解决了这个问题。如果您遇到这样的问题并且您通过 google play 控制台退款购买,那么您必须在退款表格中选中 Remove entitlement 复选框。否则作废的购买将不包括在回复中。