Reputation: 13889
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?
Upvotes: 6
Views: 2379
Reputation: 5770
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 pending1
- Payment received2
- Free trialYou can always call the Google Play API to check this state. API Docs: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource
Upvotes: 3