How to obtain package object containing promotional offers?

  • 10 August 2022
  • 1 reply

Badge +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.

1 reply

Userlevel 5
Badge +9

Hey @Tirna!

It will be one of the packages from the Offerings you’ve fetched:


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