Product
Information about a product that you configure in App Store Connect.
Declaration
struct ProductMentioned in
Overview
The Product type represents the in-app purchases that you configure in App Store Connect and make available for purchase within your app. Use Product to perform all product-related tasks in your app, from displaying in-app purchases and offers to making a purchase and getting transaction and subscription status information.
To get a Product instance, call products(for:) and provide one or more in-app purchase product identifiers. Use a Product instance to display in-app purchases and subscription offers in your store, as follows:
Show the localized name, description, and pricing information using displayName, description, and displayPrice, respectively.
Determine whether a user is eligible for an introductory offer for the product using isEligibleForIntroOffer.
Display your subscription offers using the subscription information in subscription.
When users initiate a purchase, call purchase(options:) or purchase(confirmIn:options:) on the product instance. If your app uses SwiftUI, you can also use PurchaseAction. Set purchase options (Product.PurchaseOption) to define an optional app account token, apply a promotional offer, or set a product quantity. Purchase options can also simulate an Ask to Buy scenario when you’re testing your app in the sandbox environment.
Use a Product instance to learn whether a user is entitled to a product by checking currentEntitlement, which holds the transaction that entitles the user to the product. This transaction information, as well as the transaction in latestTransaction, are cryptographically signed by the App Store in JSON Web Signature (JWS) format.
If the product is an auto-renewable subscription, use the status and renewalInfo in the subscription information to help manage subscriptions and inform business decisions, such as presenting subscription offers.
For information about configuring In-App Purchases in App Store Connect, see Overview for configuring In-App Purchases.
Topics
Requesting products from the App Store
Displaying a product description and price
displayNamedescriptiondisplayPricepricepriceFormatStylesubscriptionPeriodFormatStylesubscriptionPeriodUnitFormatStyle
Purchasing a product
purchase(options:)purchase(confirmIn:options:)purchase(confirmIn:options:)purchase(confirmIn:options:)Product.PurchaseOptionProduct.PurchaseResultProduct.PurchaseError
Receiving current entitlement information
Getting the latest transaction
Getting subscription information
subscriptionProduct.SubscriptionInfoProduct.SubscriptionPeriodProduct.SubscriptionOfferProduct.SubscriptionInfo.Status