Solved

Listen for subscription life cycle

  • 7 August 2021
  • 3 replies
  • 42 views

Badge +2

There is a way to know if the subscription has expired without doing an operation like Purchases.getPurchaserInfo ()
I understand that Purchases.addPurchaserInfoUpdateListener detects when a purchase is made, or whatever but not when a subscription expires.
I use Flutter.
If you have any advice on how to do it I would be grateful.

Thanks

icon

Best answer by cody 9 August 2021, 18:35

View original

3 replies

Badge +2

Sorry I forgot to mention that I am talking about an auto-renewing subscription

Badge

From reading https://docs.revenuecat.com/docs/purchaserinfo#listening-for-purchaser-info-updates, my understanding is that the listener would indeed trigger when a subscription is expired - at least if the PurchaserInfo object is changed as a result of that.

Userlevel 3
Badge +7

Hey @Carlo Sacchetti 👋

We’ll never push data to a client, so we’ll only call that listener when PurchaserInfo has been updated from a client operation (a purchase, restore, `getPurchaserInfo`, etc.). We recommend calling getPurchaserInfo as often as you need as we will handling caching this as needed in our SDK. As @Johan mentioned, this would cause the listener to be called after an expiration once PurchaserInfo is refreshed, but it won’t be called automatically at the time of expiration.

You can manually check the expiration date of a subscription via an entitlement in PurchaserInfo if you are unable to refresh PurchaserInfo.

Reply