Skip to main content
Solved

Clear the `CustomerInfo` cache with Stripe checkout


Forum|alt.badge.img+5

I understand that the CustomerInfo data is cached for 5 minutes, and is cleared when an actual In App Purchase is made, so the user gains access to any new entitlements immediately, however I’d like to know if there’s a way to explicitly clear this cache when working with Stripe checkouts.

 

Here’s my scenario:

  • User is makes a purchase via Stripe for a product that is registered in RevenueCat.
  • RevenueCat is informed of that purchase from my server using your Receipts API, and the users’ Customer ID is passed in.
  • In the app, I call `Purchases.getCustomerInfo`, however because of the cached nature of this call, the user typically gets no new results.  ← This behavior is jarring to the user, and I’m hoping there’s a way I can improve it
    • I have verified that after the cache expires (on average, 2.5 minutes), that call successfully loads the new data asynchronously, so I am confident that this is due to the caching

I understand the need for the caching, and how it can impact your servers - I’m comfortable directing a user to a ‘Redeem’ link, and only attempting the action there, so it’s not on every action.  Any help is appreciated!

Best answer by Haley Pace

You should use the method invalidateCustomerInfoCache() to invalidate the current cache if you want to force the SDK to fetch the CustomerInfo data again.

 

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

2 replies

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 421 replies
  • Answer
  • May 17, 2023

You should use the method invalidateCustomerInfoCache() to invalidate the current cache if you want to force the SDK to fetch the CustomerInfo data again.

 


vic-a563d7
Forum|alt.badge.img+6
  • Dedicated Member
  • 44 replies
  • November 20, 2023

in debug mode, using react native, when I call invalidateCustomerInfoCache() it just never resolves. Any idea what this could mean?


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