Solved

How to test Restore Purchase with a sandbox user?

  • 23 June 2023
  • 1 reply
  • 125 views

Badge +1

I’m trying to test the Restore Purchase functionality locally with a sandbox user for my macOS desktop app but nothing seems to happen.  Here is my code:

 

Purchases.shared.restorePurchases { purchaserInfo, error in

    if purchaserInfo?.entitlements.all["Premium"]?.isActive == true {

        NotificationCenter.default.post(name: NSNotification.Name("SubscriptionActive"), object: nil)

        closeAction()

    }

    isLoading = false

}

 

 

icon

Best answer by Michael Fogel 23 June 2023, 21:16

View original

1 reply

Userlevel 4
Badge +6

Hey @darrell-brogdon ,

 

On first glance, your code seems like it might be adding complexity that is not needed in the restore purchase functionality. 

 

We have a great document on restoring purchases which can be found here: https://www.revenuecat.com/docs/restoring-purchases

 

Below is some sample code examples that might help with implementing this functionality:

Reply