Skip to content

Instantly share code, notes, and snippets.

@rkotzy
Created April 25, 2019 02:27
Show Gist options
  • Save rkotzy/cebef06d72148fa08759b5e5313098e1 to your computer and use it in GitHub Desktop.
Save rkotzy/cebef06d72148fa08759b5e5313098e1 to your computer and use it in GitHub Desktop.
@available(iOS 12.2, *)
func showPromoUpsell() {
Purchases.shared.entitlements { (entitlements, error) in
// 1: - Get the discount for the product we want to offer
//
guard let product = entitlements?["pro_cat"]?.offerings["monthly_cats"]?.activeProduct else {
print("Error finding monthly_cat product")
return
}
guard let productDiscount = product.discounts.first(where: { $0.identifier == "promo_cat" }) else {
print("Error finding promo_cat discount")
return
}
// ... continued
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment