Question

GetCustomerInfo is returning old data, unless called twice?

  • 15 September 2022
  • 2 replies
  • 38 views

Badge

Hi,

While testing my subscriptions on IOS with a sandbox account i found a strange behaviour of getCustomerInfo(), needing to call it twice in order to get the correct data.

The way i’ve set my app is to call getCustomerInfo on appLaunch and on appResume, to check for updates. The scenario is the following:

I purchase a subscription and get back info that the entitlement is active and my expirationDate is 5min from now (because of the sandbox account). Then i minimize the app and wait 6 mins, after which i can see the sub renewal transaction appearing in rc dashboard and in the customer details screen. I open the app, which triggers getCustomerInfo, but it’s returning the same data i got from when i first purchased the sub. Then when i minimize the app and open it again, triggering getCustomerInfo for the 2nd time, it return the correct updated data with the new expirationDate.

Is this the expected behaviour? Is this because of Sandbox? Or am i doing something wrong?

P.S. it’s a flutter app, if it makes any difference.


2 replies

Userlevel 2
Badge +6

Where do you init the SDK?  My recommendation is to init the SDK a bit late, not on appLaunch (btw, I am not familiar with Flutter).  In my app, I init the SDK when I create the tab controller (viewDidLoad).  I used to init the SDK on didFinishLaunchingWithOptions and that caused all kind of random issues, thanks to Apple recent iOS startup change in iOS 15.  

Please try and let us know.

Thanks,

Badge

Hi @imougy ,

I tried to initialize it late in the app after everything else is loaded and the initial screen is rendered, but i still get the same issue.. I am not sure if this has to do something with the flutter SDK or the caching thats done for getCustomerInfo() or because of sandbox, but it’s really making it unreliable. Easiest way to reproduce is:

  1. Purchase a subscription
  2. Minimize app
  3. Cancel the purchased subscription from the app store manage subs page
  4. Wait for the subscription to expire (in my case for ios sandbox monthly sub is 5 mins)
  5. Open the app,
  6. Call getCustomerInfo() - nothing is changed user’s subscription is still active
  7. Minimize the app
  8. Open it again
  9. Call getCustomerInfo() again - this time correct information is retrieved and user sub is not active

 

Reply