【问题标题】:How to distinguish if the user is on subscription trial period or not in google play?google play如何区分用户是否处于订阅试用期?
【发布时间】:2016-12-13 13:24:41
【问题描述】:

我正在实施一项服务器端服务,用于检查用户的 google play 订阅状态​​。我使用 Android 发布者 API (https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get) 检查订阅状态。虽然,我不明白如何区分用户是处于试用期还是已经付款(我需要它来进行分析,以归因收入)?

如何做到这一点?

【问题讨论】:

  • 是一次性付款还是订阅?
  • @Ak9637 请仔细阅读问题
  • 有什么解决办法吗? @DataGreed
  • @Jorge 不,我只是比较时间。

标签: android api google-play google-play-services


【解决方案1】:

当您从服务器验证订阅购买时,您将获得这样的订阅资源:

{
  "kind": "androidpublisher#subscriptionPurchase",
  "startTimeMillis": long,
  "expiryTimeMillis": long,
  "autoRenewing": boolean,
  "priceCurrencyCode": string,
  "priceAmountMicros": long,
  "countryCode": string,
  "developerPayload": string,
  "paymentState": integer,
  "cancelReason": integer,
  "userCancellationTimeMillis": long
}

paymentState 值有 3 种订阅状态:

  • 0 - 付款待处理
  • 1 - 已收到付款
  • 2 - 免费试用

您可以随时调用 Google Play API 来检查此状态。 API文档:https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource

【讨论】:

  • 用户购买时如何获取这个json
  • @Aravindjayan 您需要将购买数据从您的 Android 应用程序发布到您的后端,并针对 Google API 进行验证。 Here is another answer 展示了如何使用 Google API 通过后端访问验证令牌
猜你喜欢
  • 2020-03-03
  • 2020-10-11
  • 2015-06-01
  • 1970-01-01
  • 2016-10-04
  • 2018-06-09
  • 2013-01-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多