[英]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.