我正在查看querying owned items,但它不包括获取用户实际购买时可用的Checkout订单ID。是否无法查询已经进行的购买的订单ID?
答案 0 :(得分:8)
Google提供的example(并在另一个答案中列出)略有错误。检索ownedItems
捆绑包时,它不包含INAPP_DATA_SIGNATURE
,而是INAPP_DATA_SIGNATURE_LIST
。
这是您可以从ownedItems
捆绑中获得的密钥列表(尽管您可能无法始终获得所有密钥):
RESPONSE_CODE
INAPP_PURCHASE_ITEM_LIST
INAPP_PURCHASE_DATA_LIST
INAPP_DATA_SIGNATURE_LIST
INAPP_CONTINUATION_TOKEN
有关它们的说明,请参阅here。
答案 1 :(得分:4)
试试这个:
Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
int response = ownedItems.getInt("RESPONSE_CODE");
if (response == 0) {
ArrayList ownedSkus =
ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
ArrayList purchaseDataList =
ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
ArrayList signatureList =
ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE");
String continuationToken =
ownedItems.getString("INAPP_CONTINUATION_TOKEN");
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
JSONObject jpurchase = new JSONObject(purchaseData);
String orderid = jpurchase.getString("orderId");
Log.v(TAG,"ORDER ID :"+orderid );
}
}
感谢。