Skip to main content
Answer

Receiving active entitlement even the purchase is expired.

  • October 23, 2021
  • 2 replies
  • 193 views

Forum|alt.badge.img+3

I am receiving entitlement.isActive == true when expiration date is already long passed.

Here’s my code:

Purchases.shared.purchaserInfo { (purchaserInfo, error) in
if let error = error {
complete(.failure(error))
return
}
if let entitlement = purchaserInfo?.entitlements.all[Self.entitleId] {
if entitlement.isActive {
UserDefaults.subscriptionCache = SubscriptionCache(isSubscribe: true, lastCheckedDate: Date())
}
complete(.success(entitlement.isActive))
} else {
complete(.failure(IAPError.noPurchasedItem))
}
}

Here’s my result:

 

The current time is 10/23 0:00 UTC

 

Please help me with this issue.

Best answer by jazmine

Hey @Kuang , 

It looks like this issue is being handled in Zendesk. It seems like you ran into an issue with a stale cache. The SDK will update the cache if it's older than 5 minutes, but only if you call getPurchaserInfo(), make a purchase, or restore purchases, so it's a good idea to call getPurchaserInfo() any time a user accesses premium content. You can always check the request date of your cache to see if it’s old. 

This post has been closed for comments

2 replies

jazmine
Forum|alt.badge.img+7
  • Dedicated Contributor
  • Answer
  • November 5, 2021

Hey @Kuang , 

It looks like this issue is being handled in Zendesk. It seems like you ran into an issue with a stale cache. The SDK will update the cache if it's older than 5 minutes, but only if you call getPurchaserInfo(), make a purchase, or restore purchases, so it's a good idea to call getPurchaserInfo() any time a user accesses premium content. You can always check the request date of your cache to see if it’s old. 


Forum|alt.badge.img+3
  • Author
  • New Member
  • November 9, 2021

Hi Jazmine,

Thank you for the clear reply.

I’ll check to see if this is the reason.