Subscriptions 101 for Android apps

Emilie Roberts
Android Developers
Published in
4 min readApr 3, 2019

Subscriptions on Google Play Billing can be an excellent way to grow your business. However, coordinating between your Android app and back-end server can be daunting.

The Subscriptions 101 video series will help you understand how all the pieces of the subscription puzzle fit together, including basic server setup, real-time developer notifications, upgrades and downgrades, linkedPurchaseToken, grace period, and more.

Understanding Subscriptions

The first video outlines the terminology that will be used throughout the video series and describes the various components you’ll need including: your Android app, your back-end server, the Google Play Billing Library, the Google Play Developer API, and Google Cloud Pub/Sub.

Subscription Purchase Flow

This video describes the purchase flow for subscriptions. Using the Google Play Billing Library, you can check for existing subscriptions and launch the billing flow for new signups. After a successful purchase, you will get back a purchase token and the order ID, which represent the user’s entitlement and transaction with Google respectively. Keep track of this information on your secure back-end server in order to correctly grant access to your product or services.

Real-time Developer Notifications

Real-time Developer Notifications (RTDN) allow you to stay up-to-date with the state of your subscriptions via notifications to your server from Google Cloud Pub/Sub.

When you receive an RTDN notification, verify the purchase token contained in that notification and retrieve detailed information about that subscription using the Google Play Developer API.

Upgrade and Downgrade

You can let users upgrade and downgrade a subscription in your app using the Google Play Billing Library. First, verify that the user has a current subscription with queryPurchases(). Then call setOldSku() with the SKU for the subscription that will be replaced. Finally, call setSku() using the new subscription SKU. This will return a new purchase token representing the upgraded or downgraded subscription. Be sure to handle linkedPurchaseToken correctly.

Grace Period

This video covers setting up a grace period for a subscription, which can help you retain users by allowing them a short time to fix their payment information in case of a renewal failure.

In the Google Play Console, enable grace period and choose its length of time in each individual subscription’s settings. When you receive an RTDN notifying you that a user is in a grace period, verify the subscription status using the Google Play Developer API. Then, provide the user with a notice in your app with a deep-link to the subscriptions center so they can easily fix their payment settings. Remember, a user should retain access to the subscription during the grace period.

Account Hold

This video describes account hold, a way for users who have an issue with their payment method to easily restore access to an app’s content without having to re-subscribe. This can increase user retention.

Enable account hold for all of an app’s subscriptions by expanding the Subscription Settings menu in the Subscriptions tab of the In-App Products sections of the Google Play Console. On your back-end, when you receive an RTDN notifying you a user is in account hold, verify the subscription status using the Google Play Developer API. You should then block access to the subscription and let the user know there is an issue with their payment method, providing a deep-link to the subscriptions center so they can easily fix their payment settings.

Cancel and Restore

Allowing users to easily restore their subscriptions after cancellation helps regain and retain previously active users. After a user has cancelled a subscription, they retain access to your app’s content until the expiration of the subscription period. During this time they can easily restore their subscription in the Google Play Subscriptions Center.

After receiving an RTDN notifying you that a user has cancelled a subscription, you may wish to show a polite reminder about the upcoming expiration date in your app and provide a deep-link to the subscriptions center to allow them to easily restore their subscription.

Defer Billing

Deferring a billing date is an easy way to provide temporary access without charge to subscribers as a promotion or if they experienced a service outage. Using the Google Play Developer API, you can advance a subscribed user’s billing date to offer them free access to your services for a specified period of time. The subscription renewal date will be adjusted to reflect the new billing date passed to the API.

Ready? Go!

I hope these videos help you understand how to implement subscriptions in your app! Ready? Go!

Resources

--

--

Emilie Roberts
Android Developers

Partner Developer Advocate at Google. Canadian, vegan, roller derby athlete.