Skip to main content

I use swift code with storyboard , and I have in my code subscription button  , but this button show only Annual subscription , I have monthly and yearly product Id in my entitlement , but it’s always show yearly price after I press that button . I want make two or more buttons one for Monthly , Yearly and also Lifetime if possible . But I don’t know how .. This my code , and the : fullappaccess is the Identifier for my entitlement in revenuecat

 

Swift Code :

@objc func goPremiumButtonTapped(sender:UIButton) {



    

        

        let package = self.packagesAvailableForPurchaseesender.tag]

        

        Purchases.shared.purchasePackage(package) { (transaction, purchaserInfo, error, userCancelled) in

          

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

                self.dismiss(animated: true, completion: nil)

            }

        }

        hapticFeedback()

    }

 

    

Hey @Hussain Barakat 

I would recommend creating these buttons programmatically so the paywall can be dynamic to your Offerings. We have sample code in Swift that’s worth checking out: https://github.com/RevenueCat/purchases-ios/blob/main/Examples/MagicWeather/MagicWeather/Sources/Controllers/PaywallViewController.swift#L24-L35 


Reply