我正在将Google应用内购买(特别是订阅)集成到我们的应用程序中。现在我无法弄清楚如何从IMarketBillingService(Google Play)获取以下数据到我的应用程序中:
- 价格信息 - 订阅到期日期(当前付款周期) - 如果用户取消正在进行的订阅,则通知
以下代码解析了来自获取购买信息的JSON对象,但其中没有价格字段。然而,Google IAP文档表示价格可用!
- 价格信息 - 订阅到期日期(当前付款周期) - 如果用户取消正在进行的订阅,则通知
以下代码解析了来自获取购买信息的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);
需要帮忙吗?