Skip to main content
Solved

Receiving active entitlement even the purchase is expired.


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. 

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

2 replies

jazmine
Forum|alt.badge.img+7
  • Dedicated Contributor
  • 122 replies
  • 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
  • 1 reply
  • November 9, 2021

Hi Jazmine,

Thank you for the clear reply.

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


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