【问题标题】:Google play developer API - Voided Purchases API dosen't workGoogle Play 开发者 API - 无效购买 API 不起作用
【发布时间】:2018-03-06 02:30:08
【问题描述】:

我想问一个关于 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

托尼

【问题讨论】:

  • 这是我的示例代码。
  • 我也有同样的问题。你找到解决办法了吗?
  • 似乎谷歌只退回一周前“作废”的订单
  • 有人可以证实@Jarod 的经历吗?

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


【解决方案1】:
    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
    }
  ]
}

【讨论】:

  • 谢谢你。我使用这个 API,并且通过了 OAuth2 检查。响应没问题,但我得到 voidedPurchases = null
猜你喜欢
  • 1970-01-01
  • 2014-03-25
  • 2013-06-17
  • 2016-05-03
  • 2016-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多