Skip to main content
Question

How to obtain package object containing promotional offers?

  • August 10, 2022
  • 1 reply
  • 192 views

Forum|alt.badge.img+2

I’m implementing 2 promotional offers, and have been following the official documentation. I tried to add the source code in the docs to obtain the promotional offers, like this:

if let discount = package.storeProduct.discounts.first {
    Purchases.shared.getPromotionalOffer(forProductDiscount: discount, product: package.storeProduct) { (promoOffer, error) in
        if let promoOffer = promoOffer {
            // Promotional Offer validated, show terms of your offer to your customers
        } else {
            // Promotional Offer was not validated, default to normal package terms
        }
    } 
}

 

but I don’t know how to obtain ‘package’, which appears in the first line of the above code.

This post has been closed for comments

1 reply

ryan
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 391 replies
  • December 5, 2022

Hey @Tirna!

It will be one of the packages from the Offerings you’ve fetched: https://www.revenuecat.com/docs/displaying-products#fetching-offerings

 

Purchases.shared.getOfferings { (offerings, error) in
    if let packages = offerings?.current?.availablePackages {
        // Display packages for sale
    }
}

 


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