0

I want to ask a question about IAB API - Voided Purchases API https://developers.google.com/android-publisher/api-ref/purchases/voidedpurchases/list

I have a formal order, and I have refunded it. the order status is refunded. I use Voided Purchases API, but always get empty data (voidedPurchases = null). Please get me some suggestion about using this API. Thank you very much.

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 return status = 200, But voidedPurchases value of result object is null

Tony

Tony Wu
  • 31
  • 3

2 Answers2

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
    }
  ]
}
Argus Malware
  • 773
  • 7
  • 19
  • 1
    thank you shashi. I use this API, and I pass the OAuth2 check. the respone is ok, But I get voidedPurchases = null – Tony Wu Sep 25 '17 at 08:22
0

It's already very late, but I came here through a search.

In my case, as written in the Google document, the data was not inquired because I refunded without pressing the 'cancel' option.

I'm writing for developers who might be solving it like me.

Thank you. :)

"Developer cancels or refunds order. Note: only revoked orders will be shown in the Voided Purchases API. If developer refunds without setting the revoke option, orders will not show up in the API."

https://developers.google.com/android-publisher/voided-purchases
sm.kim
  • 1