2017-09-25 133 views
-2

我想問一個關於IAB API的問題 - 作廢購買API https://developers.google.com/android-publisher/api-ref/purchases/voidedpurchases/list谷歌Play開發API - 作廢購買API這麼想的工作

我有一個正式的秩序,我已經退還了。 退貨訂單狀態。 我使用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

託尼

+0

這是我的示例代碼。 –

+0

我有同樣的問題。你有沒有找到解決方案? – jboo

回答

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 
    } 
    ] 
} 
+0

謝謝你shashi。我使用這個API,並且通過了OAuth2檢查。答覆是好的,但我得到voidedPurchases = null –