我正在查看querying owned items,它不包括获取用户实际购买时可用的结帐订单ID。无法查询已经购买的订单ID?

最佳答案

尝试这个:

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 );
   }
}


谢谢。

10-05 18:41