【发布时间】:2012-08-24 10:02:15
【问题描述】:
我正在将 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);
有什么帮助吗?
【问题讨论】:
-
我注意到自己对取消订阅的回答: “在订阅因未付款或用户取消而到期之前,Google Play 不会通知您的应用购买状态更改。”