Skip to main content
Question

How to obtain package object containing promotional offers?

  • August 10, 2022
  • 1 reply
  • 210 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:

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

 

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

 

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

 


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