I'm looking at querying owned items, and it doesn't include getting Checkout order IDs that are available when user actually makes a purchase. Is there no way to query the order ID for a purchase that have already been made?
Asked
Active
Viewed 3,233 times
2 Answers
8
The example given by Google (and listed in another answer) is slightly wrong. When retrieving the ownedItems
bundle, it does not contain INAPP_DATA_SIGNATURE
but rather INAPP_DATA_SIGNATURE_LIST
.
This is the list of keys you can get from the ownedItems
bundle (though you may not get all of them all the time):
RESPONSE_CODE
INAPP_PURCHASE_ITEM_LIST
INAPP_PURCHASE_DATA_LIST
INAPP_DATA_SIGNATURE_LIST
INAPP_CONTINUATION_TOKEN
See here for descriptions of them.

ubzack
- 1,878
- 16
- 16
-
Took me a while to figure out... Damn – Antoine Lassauzay Oct 22 '13 at 18:01
4
Try this:
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 );
}
}
Thanks.

Pratik Sharma
- 13,307
- 5
- 27
- 37
-
-
Do you happen to know if the payload is also there? I haven't set everything up to make a purchase and see for myself yet. – Violet Giraffe Jan 10 '13 at 16:27
-
@VioletGiraffe yes `developerPayload` will be there also with `purchaseData`. – Pratik Sharma Jan 10 '13 at 16:28