Search

Track your subscriptions better with the Google Play Developer API

Posted by Neto Marin, Developer Advocate

Back in 2012, we introduced free trials support for Android app subscriptions. A free trial runs for a period of time that you set and then automatically converts to a full subscription based on the subscription's billing interval and price. Google Play supports free trials for all subscription types. Check out Free trials in our documentation for more details.

This feature is an important tool for user conversion because the user can try your app or game before committing to paying. To help you track the subscription status better, we are adding a third "paymentState" value to the Purchases.subscriptions API (on Google Play Developer API) to represent that the user is in a free trial. Possible values are:

  • 0 - Payment pending
  • 1 - Payment received
  • 2 - Free trial

Since there is a new possible value, it is necessary to check how your back end is handling the paymentState parameter. If you are doing something like this, you potentially could have a problem:

// WARNING: Don't do this!
if (paymentState == 1) {
    // User is in normal state
} else {
    // Handle user in grace period   # this would now be a bug
}

As a best practice, and to avoid issues on future updates, we recommend checking specifically for each possible case, like this:

if (paymentState == 0) {
    // Subscriber with payment pending
} else if (paymentState == 1) {
    // Subscriber in good standing (paid)
} else if (paymentState == 2) {
    // Subscriber in free trial
}

You can check the Purchases.subscriptions documentation for more details. And if you're not offering free trials in your app or game, don't miss the chance to increase user conversions by letting them have a taste of your app - check out our documentation on Free trials.



Bagikan Berita Ini

0 Response to "Track your subscriptions better with the Google Play Developer API"

Post a Comment


Powered by Blogger.