繁体   English   中英

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

[英]How to distinguish if the user is on subscription trial period or not in google play?

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

如何才能做到这一点?

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

{
  "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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM