Solved

Should getCustomerInfo() return Family Sharing subscription status?

  • 2 November 2022
  • 3 replies
  • 19 views

Badge +1

The below Swift code works for authenticating subscribed purchases but does not always work for family sharing (Family Sharing is recognized by Apple but revenueCatManager.isSubscriptionActive returns false).

Purchases.shared.getCustomerInfo { (customerInfo, error) in
                if customerInfo?.entitlements.all["Regular"]?.isActive == true {
                    revenueCatManager.isSubscriptionActive = true
                    let purchasedProductSet = customerInfo?.activeSubscriptions
                    for purchasedProduct in purchasedProductSet! {
                        product_id += purchasedProduct
                    }
                    let expireRenewalDate = customerInfo?.expirationDate(forEntitlement: "Regular") ?? Date()
                    let formatter = DateFormatter()
                    formatter.dateFormat = "MMM d, y"//"EEEE, MMMM d, yyyy h:mm:ss a zzzz"
                    renewalDate = formatter.string(from: expireRenewalDate)
                } else {
                    revenueCatManager.isSubscriptionActive = false
                }
            }

icon

Best answer by ryan 5 November 2022, 00:18

View original

3 replies

Userlevel 5
Badge +9

Hey @Peter Bonac

For Family Shared purchases, the customer may need to `.restoreTransactions()` to sync the device receipt with RevenueCat and unlock access. 

Calling getCustomerInfo() checks the server-side subscription status from RevenueCat and is not directly reading the device receipt. 

Badge +1

Hi @ryan, thank you for the info. 

It was my understanding that checking the “server-side subscription status from RevenueCat” every time someone opens the app is the proper approach. Is this not the case?

Userlevel 5
Badge +9

Hey Peter,

Your approach is correct, but those customers with a Family Shared subscriptions will need to restore purchases once to let RevenueCat know to unlock access. 

Reply