Question

Purchases.getCustomerInfo returns incorrect (cached) value, no matter what fetch policy I try

  • 22 April 2024
  • 1 reply
  • 30 views

Badge

I am using Android SDK, revenuecat version 7.0, and this is my code (kotlin):

Purchases.sharedInstance.getCustomerInfoWith(
fetchPolicy = CacheFetchPolicy.FETCH_CURRENT,
onError = { error: PurchasesError ->
log("END with ERROR = $error")
},
onSuccess = { customerInfo: CustomerInfo ->
val purchased = customerInfo.entitlements["premium"]?.isActive
log("END with SUCCESS: isActive = $purchased")
})

Consider following scenario:

  1. Before purchasing a product = getCustomerInfo properly returns no active entitlements (as I never purchased the product)
  2. After I purchase the product = getCustomerInfo properly returns existing active entitlement (as I just purchased product)
  3. After I refund my purchase in Play Console (including checked checkbox "Remove entitlement") =  getCustomerInfo incorrectly still returns I do have active entitlements. Even after hours, even after I specifically used fetch policy forcing fresh server value...

Such behavior is in my opinion not correct…

Is it a bug or am I doing something wrong? Why is revenuecat getCustomerInfo function not returning the latest fresh result? Or is that intended behavior, that entitlements still remain active, even after I manually perform refunding? If so, can this be turned off?


This post has been closed for comments

1 reply

Userlevel 4
Badge +6

Hey @mil84,

 

I recommend calling getCustomerInfo() somewhere else in the app as well so this object is updated when the app is opened regardless. Is the method called in the case of 3 where the refund happens and then the user opens the app up later? The SDK will update the cache if it's older than 5 minutes, but only if you call getCustomerInfo(), make a purchase, or restore purchases, so it's a good idea to call getCustomerInfo() often to ensure the object is up-to-date.