Solved

Clear the `CustomerInfo` cache with Stripe checkout

  • 12 May 2023
  • 2 replies
  • 137 views

Badge +1

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!

icon

Best answer by Haley Pace 17 May 2023, 16:32

View original

2 replies

Userlevel 4
Badge +8

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

 

Badge +5

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

Reply