Question

UpdatedPurchaserInfoListener returns empty activeSubscriptions in Sandbox

  • 15 March 2022
  • 6 replies
  • 192 views

Badge +1

Hi,


I’m a currently facing an issue in sandbox mode with renewal subscriptions in Android.

When I purchase I get the activeSubscriptions property within the UpdatedPurchaserInfoListener(onReceived) but after some time, if I kill the app and relaunch it, the listener will return an empty activeSubscriptions.

And still, after some time, killing the app again and relaunching it will give me the expected activeSubscriptions.

This is happening before the subscription gets cancelled after the 6th renewal.

So why do I get this empty activeSubscriptions property whereas the subscription is supposed to be active ? It’s really annoying

Thanks for helping :pray:


6 replies

Userlevel 5
Badge +10

Hi @Baptiste 

(note: PurchaserInfo was recently updated to CustomerInfo in our iOS SDK v4.x. Other SDK updates are in progress). 

The PurchaserInfo listener will fire whenever the SDK receives an updated PurchaserInfo object from calls to getPurchaserInfo(), purchase, or restorePurchases(). If you restarted the app and no new subscriptions have occurred, the listener shouldn’t trigger or report new subscriptions.

 

And still, after some time, killing the app again and relaunching it will give me the expected activeSubscriptions.

Due to the way the listener works, it sounds like the SDK detected an updated PurchaserInfo object, which caused the listener to trigger. 

 

To check if a subscription is active, you should be checking the PurchaserInfo object directly. Old version of the docs for reference: https://docs.revenuecat.com/v3.3/docs/purchaserinfo 

 

 

Badge +1

Hi @tina 

If you restarted the app and no new subscriptions have occurred, the listener shouldn’t trigger or report new subscriptions.


I didn’t update/cancel the subscription, maybe a renewal happened I don’t know (but should I care ?). I just don’t understand why the listener returns an empty activeSubscriptions.
 

To check if a subscription is active, you should be checking the PurchaserInfo object directly. Old version of the docs for reference: https://docs.revenuecat.com/v3.3/docs/purchaserinfo 


Does this mean I also have to check manually the PurchaserInfo object state to determine if there is an active subscription ?

Seems like it is not relevant to use UpdatedPurchaserInfoListener at launch if the returned value is not correct. Should I use it only during payment flow ? and PurchaserInfo object the rest of the time (eg: app is launched)

Thanks

Userlevel 5
Badge +10

Hi @Baptiste 

I didn’t update/cancel the subscription, maybe a renewal happened I don’t know (but should I care ?). I just don’t understand why the listener returns an empty activeSubscriptions.

My assumption here is that an expiration event occurred while the app was not open. So when you reopened the app, the listener detected that the PurchaserInfo object changed and returned an empty activeSubscriptions.

Does this mean I also have to check manually the PurchaserInfo object state to determine if there is an active subscription ?

Depending on your app, it may be sufficient to manually check the PurchaserInfo object before granting someone access to an unlocked feature within the app. 

 

The listener would not trigger as often in production since the renewal times are much more spread out. Sandbox subscriptions have accelerated renewal times, so the sandbox user could have been in a state when the subscription actually already expired.

Badge +1

Hi @Baptiste 

I didn’t update/cancel the subscription, maybe a renewal happened I don’t know (but should I care ?). I just don’t understand why the listener returns an empty activeSubscriptions.

My assumption here is that an expiration event occurred while the app was not open. So when you reopened the app, the listener detected that the PurchaserInfo object changed and returned an empty activeSubscriptions.

The subscription was not expired. Maybe a renewal happened but it should not remove the ongoing active subscription to make it available again few minutes later.
Because of that, some of us have to use the restore purchase to get back the active subscription, but some others cant make it work with the restore purchase, really unstable in sandbox.

 

I’ll try to find a way to make it work as expected. 😓

Thanks

Badge +1

So after spending some time on it..

On an ongoing active subscription.

If I open the app, and try to get PurchaserInfo object:

  • UpdatedPurchaserInfoListener: activeSubscriptions:  {empty}
  • getPurchaserInfo: activeSubscriptions:  {empty}

Opening the app few minutes after:

  • UpdatedPurchaserInfoListener: activeSubscriptions:  {not empty}
  • getPurchaserInfo: activeSubscriptions:  {empty}

Behavior is different with the two methods but in both cases it does not work as expected.

I don’t know what I can do now.. The QA team is really troubled with this situation.


Its pretty simple...if I start a subscription I expect to be Premium from the beginning to the end of the test subscription. Why do I get empty active subscription after the 1st renewal for example ?

Userlevel 5
Badge +10

Hey @Baptiste 

When receiving an empty activeSubscriptions, have you also checked the customer history for the sandbox user’s current subscription status? Specifically the ‘Entitlements’ card in the UI would inform you if it is is currently active or not. 

I’m taking a look at your app’s settings and I notice that you don’t have server to server notifications enabled. This isn’t required, but is recommended so RevenueCat can get pinged of receipt updates from Google directly. Can your team enable this feature and let me know if you’re still encountering the same issue?

Reply