在Android应用内结算中获取订阅数据

在Android应用内结算中获取订阅数据,第1张

概述我正在将Google应用内结算功能(尤其是订阅)整合到我们的应用中. 现在我无法弄清楚如何从IMarketBillingService(Google Play)获取以下数据到我的应用: >价格信息 >订阅到期日(当前付款期) >如果用户取消正在进行的订阅,则会收到通知 以下代码解析了获取购买信息所产生的JSON对象,但其中没有价格字段.然而Google IAP文档说价格可用!? JSONObjec 我正在将Google应用内结算功能(尤其是订阅)整合到我们的应用中.

现在我无法弄清楚如何从IMarketBillingService(Google Play)获取以下数据到我的应用:

>价格信息
>订阅到期日(当前付款期)
>如果用户取消正在进行的订阅,则会收到通知

以下代码解析了获取购买信息所产生的JSON对象,但其中没有价格字段.然而Google IAP文档说价格可用!?

JsONObject jElement = jTransactionsArray.getJsONObject(i);int response = jElement.getInt("purchaseState");PurchaseState purchaseState = PurchaseState.valueOf(response);String productID = jElement.getString("productID");String packagename = jElement.getString("packagename");long purchaseTime = jElement.getLong("purchaseTime");String orderID = jElement.optString("orderID","");String purchase_token = jElement.optString("purchasetoken","");String notifyID = null;if (jElement.has("notificationID")) {  notifyID = jElement.getString("notificationID");}String developerPayload = jElement.optString("developerPayload",null);

有帮助吗?

解决方法
price information

Google Play的结算服务不提供定价信息.如果您真的需要它,您可以通过记录您的商品价格并猜测用户的货币来自己提供这些信息.

subscription expiry date (of the currently paID period)

阅读检查Subscriptions API Guide中的订阅有效性.有一个HTTP-based API可以在Google Play上查看订阅的当前购买状态.

notification if the user cancels an on-going subscription

没有提供.从Subscriptions API Guide:

If a user cancels a subscription,Google Play consIDers the subscription valID until the end of the current billing cycle. The user continues to enjoy the content for the rest of the cycle and is not granted a refund.

总结

以上是内存溢出为你收集整理的在Android应用内结算中获取订阅数据全部内容,希望文章能够帮你解决在Android应用内结算中获取订阅数据所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1129088.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存