Skip to main content
Solved

Listen for subscription life cycle


Forum|alt.badge.img+7

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

Best answer by cody

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.

View original
Did this post help you find an answer to your question?

3 replies

Forum|alt.badge.img+7

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


Forum|alt.badge.img
  • New Member
  • 3 replies
  • August 9, 2021

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.


cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 497 replies
  • Answer
  • August 9, 2021

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings