Skip to main content
Question

Two separate paywall footers for separate entitlements/offerings


Forum|alt.badge.img+1

I am thinking about configuring two separate entitlements in my app. One for “Premium” (access to GPT-3.5 among other features) users and another tier for “Plus” users who will have access to GPT-4 on top of premium features. Premium users should be the only users that can upgrade to Plus. GPT-4 API costs are expensive which is the reason to separate things out.

I’m struggling a bit to implement the syntax in SwiftUI. I have two separate entitlements so naturally I would like to implement two separate paywall footers on two paywall screens, but the only way to configure them separately is to give them an “Offering”. I’m not sure how to initialize this offering without introducing an optional into the equation.

.paywallFooter(offering: *initializedOffering*, condensed: true)

Writing things this way seems like hardcoding which would not allow me to change things remotely after each paywall has an offering fed to it. I would appreciate some insight into how I should proceed here.

My code in production with one paywall looks like this. It displays the one offering i’ve selected in RevenueCat which works fine for one paywall.

.paywallFooter(condensed: true)

This post has been closed for comments

2 replies

Forum|alt.badge.img+1
  • Author
  • New Member
  • 1 reply
  • April 2, 2024
class IsEntitled: ObservableObject {
   static var shared = IsEntitled()

   @Published var offerings: [String: Offering] = [:]

   init() {
       refreshEntitlements()
   }

   func refreshEntitlements() {
     Purchases.shared.getOfferings { offerings, error in
        if let nonOptionalOfferings = offerings {
             self.offerings = nonOptionalOfferings.all

   [...]

}

struct Paywall: View {
   @ObservedObject var entitlementManager: IsEntitled = IsEntitled.shared

   var body: some View {
     paywallContent()
       .paywallFooter(entitlementManager.offerings["Default"] << returns an optional
   }
}

This is what my code looks like so far


Ryan Glanz
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 383 replies
  • April 4, 2024

Hi,

Our Offering metadata feature may help here. You can send JSON data alongside an offering, which could allow you to toggle offerings in the dashboard and have them show up without code changes.

 

So for example, in the dashboard you could have the following Offerings: “standard”, “upsell”, and “upsell (aggressive)”

 

Then in your app, you could have something like (pseudocode)

if customerInfo.entitlements.premium.isEmpty {
  // show default paywall
}

if customerInfo.entitlements.premium?.isActive == true {
  // show the paywall with { defaultUpsellOffer: true } metadata
}

If you want to toggle between the “upsell” and “upsell (aggressive)” Offerings w/o a code change, just flip one’s metadata to true and the other to false for that parameter.


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