谷歌播放开发者API - 无效购买API不起作用

时间:2017-09-25 07:33:32

标签: android in-app-purchase android-inapp-purchase

我想问一个关于IAB API的问题 - Voided Purchases API https://developers.google.com/android-publisher/api-ref/purchases/voidedpurchases/list

我有正式的订单,我退还了它。 订单状态退款。 我使用Voided Purchases API,但始终获取空数据(voidedPurchases = null)。 请告诉我一些关于使用此API的建议。 非常感谢你。

AndroidVoidedPurchasesResponse result;

HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
ClassLoader classLoader = getClass().getClassLoader();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId("service account id")
.setServiceAccountScopes(Collections.singleton("https://www.googleapis.com/auth/androidpublisher"))
.setServiceAccountPrivateKeyFromP12File(new File("p12 file path"))
.build();

AndroidPublisher pub = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential).setApplicationName("packageName").build();
AndroidPublisher.Purchases.Voidedpurchases.List getList = pub.purchases().voidedpurchases().list("packageName");
result = getList.execute();

http返回状态= 200, 但是voidedPurchases结果对象的值为null

Tony

1 个答案:

答案 0 :(得分:0)

    you can make a simple curl request to the following api

    curl -i https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/voidedpurchases


your response would be like this
{
  "tokenPagination": {
    "nextPageToken": string
  },
  "voidedPurchases": [
    {
      "kind": "androidpublisher#voidedPurchase",
      "purchaseToken": string,
      "purchaseTimeMillis": long,
      "voidedTimeMillis": long
    }
  ]
}