Contents

Product.SubscriptionInfo.PricingTerms.PricingModel

The pricing models of an auto-renewable subscription, with the pricing details for each model.

Declaration

enum PricingModel

Overview

Switch over a pricing model to get a subscription’s pricing details. A subscription that a customer buys individually uses the Product.SubscriptionInfo.PricingTerms.PricingModel.singlePrice(_:) model. A subscription that a customer buys with seats uses the Product.SubscriptionInfo.PricingTerms.PricingModel.seatBased(_:) model, which provides a per-seat price for each price tier.

StoreKit might add pricing models in the future, so include an @unknown default case when you switch over a pricing model.

The following example builds a price label for single-price terms, and a label for each price tier of seat-based terms:

var priceLabel = ""
var tierLabels: [String] = []

switch pricingTerms.pricingModel {
case .singlePrice(let singlePrice):
    priceLabel = singlePrice.billingInfo.displayPrice
case .seatBased(let seatBasedPricing):
    tierLabels = seatBasedPricing.priceTiers.map { tier in
        let seats = tier.maximumSeats.map { "\(tier.minimumSeats)-\($0)" } ?? "\(tier.minimumSeats)+"
        return "\(seats) seats: \(tier.billingInfo.displayPrice) per seat"
    }
@unknown default:
    break
}

For more information, see Supporting multiseat purchases in your app.

Topics

Identifying the pricing model

See Also

Getting the pricing model