如何区分用户是否在Google Play中订阅试用期?

时间:2016-12-13 13:24:42

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

我正在实施一项服务器端服务,用于检查用户的Google Play订阅状态。我使用Android Pubisher API(https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get)来检查订阅状态。虽然,我无法理解如何区分用户是否处于试用期或者他是否已经付款(我需要它用于分析,归因于收入)?

如何做到这一点?

1 个答案:

答案 0 :(得分: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

相关问题