简体   繁体   English

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

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

I am implementing a server-side service that checks user's google play subscriptions status. 我正在实施一项服务器端服务,用于检查用户的Google Play订阅状态。 I use the Android Pubisher API ( https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get ) to check the subscription status. 我使用Android Pubisher API( https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get )来检查订阅状态。 Though, I cannot understand how to distinguish if the user is on trial period or if he has already paid (i need it for analytics, to attribute revenue)? 虽然,我无法理解如何区分用户是否处于试用期或者他是否已经付款(我需要它用于分析,归因于收入)?

How can this be done? 如何才能做到这一点?

When you validate the subscription purchase from your server, you are going to get the subscription resource like that: 当您从服务器验证订阅购买时,您将获得以下订阅资源:

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

The paymentState value has 3 states for subscriptions: paymentState值有3个订阅状态:

  • 0 - Payment pending 0 - 待付款
  • 1 - Payment received 1 - 收到付款
  • 2 - Free trial 2 - 免费试用

You can always call the Google Play API to check this state. 您随时可以调用Google Play API来检查此状态。 API Docs: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource API文档: https//developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource

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

相关问题 您的 Google Playstore 订阅没有试用期是否仍会自动让用户订阅该订阅? - Does having no trial period on your Google playstore subscription still automatically subscribe the user to the subscription? Google Play 免费试用期测试攻略 - Google Play Free Trial Period testing strategy 在 Google Play 上为 Android 订阅启用免费试用 - Enable Free Trial for Android Subscription on Google Play 如何确定用户是否取消Google Play订阅? - How to determine if user cancels Google Play subscription? 一段时间后如何在Google Play中发布试用版应用和续订付款 - How to publish apps for trial version and renew payment after a period of time in google play 如何防止滥用应用免费试用期(非订阅)? - How to prevent abuse of app free trial period (non-subscription)? 试用期过后,所有Google Play订阅都将退还 - All Google Play subscriptions are refunded after trial period 谷歌播放订阅和移动应用免费试用自动取消/结束 - Google play subscription and free trial for mobile app automatically cancels/ends 应用内订阅试用期完成通知 - In app subscription trial period completion notification 如何计算在给定时间段内Google Play商店应用的自动续订续订数量? - How do I count the number of automatic subscription renewals for Google Play Store App at given period of time?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM