I am implementing a server-side service that checks user's google play subscriptions status. I use the Android Pubisher API ( https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get ) to check the subscription status. 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:
0
- Payment pending 1
- Payment received 2
- Free trial You can always call the Google Play API to check this state. API Docs: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.