google-play - Google Play应用内结算-列出购买

标签 google-play in-app-purchase google-play-services billing android-billing

我希望获得我已购买但尚未消费的应用内购买 list 。

Google Play是否提供此类API?

最佳答案

https://developer.android.com/google/play/billing/billing_integrate.html#QueryPurchases

Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
int response = ownedItems.getInt("RESPONSE_CODE");
if (response == 0) {
   ArrayList<String> ownedSkus =
      ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
   ArrayList<String>  purchaseDataList =
      ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
   ArrayList<String>  signatureList =
      ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
   String continuationToken =
      ownedItems.getString("INAPP_CONTINUATION_TOKEN");

   for (int i = 0; i < purchaseDataList.size(); ++i) {
      String purchaseData = purchaseDataList.get(i);
      String signature = signatureList.get(i);
      String sku = ownedSkus.get(i);

      // do something with this purchase information
      // e.g. display the updated list of products owned by user
   }

   // if continuationToken != null, call getPurchases again
   // and pass in the token to retrieve more items
}

关于google-play - Google Play应用内结算-列出购买,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40549463/

相关文章:

flutter - 如何从Play商店获取包名和版本号?

ios - 使用应用作为应用内购买的内容

android - 无法找到依赖项 com.google.android.gms :play-services-ads-lite:[10. 2.4]

android - 谷歌视觉 API : Handle native crash

android - Google Developers Console 项目和 Google **Play** Developers Console 项目有什么区别?

android - 将android应用程序分成两个 'branches' ,免费和付费

ios - 如何实现内购赠送?

java - android应用程序内计费错误IInAppBillingService.aidl

android - 更改安卓 :installLocation from auto to internalOnly can lead to Play Store error 963

ios - 在App Purchase中可以在测试模式下正常运行,但不能在App Review中运行