我正在实现一项检查用户的 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
关于android - 如何区分用户是否在谷歌播放订阅试用期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41122253/