3

When integrating the Google Play Billing Library, how to know the state of a subscription? I want to know what of the below states is it, base on the Sell Subscriptions lifecycle.

  • Active
  • Cancelled
  • In grace period
  • On hold
  • Paused
  • Expired

To be more precise, when registering to PurchasesUpdatedListener via BillingClient.newBuilder(activity).setListener() you are getting a list of purchases via onPurchasesUpdated(BillingResult, List<Purchase>), how to know the state of each subscription purchase based on the above states?

At the moment I extract the purchase time from purchase.getPurchaseTime() and the subscription period from skuDetails.getSubscriptionPeriod() to check if the subscription is active. But that only gives me the Expired and the Active states, how can I get the rest?

Also, I am aware of the Real-time developer notifications, but I want to handle this, solely on the client.

Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216

0 Answers0