Build a SwiftUI paywall with StoreKit views
Apple's StoreKit views, introduced for iOS 17, let SwiftUI apps present native purchase interfaces without drawing every product row from scratch. This guide explains when StoreView, ProductView and SubscriptionStoreView fit, what each handles automatically, and where you must add your own logic.
Set up the example catalogue first
Before choosing a view, confirm that your products exist in App Store Connect or in a local StoreKit configuration file for development. The worked example uses a Pro subscription group containing weekly, monthly and yearly plans, with the yearly plan offering a one-week trial, plus a separate lifetime purchase. That mix matters: it is exactly the case where the three views behave differently. Protected modules code0001 to code0012 contain the exact implementation contracts for the examples below; refer to those modules rather than retyping their contents.
StoreView: the complete list with the least assembly
StoreView is the fastest route to a complete list. Give it product IDs and it renders each product with its own purchase button. A product already purchased is shown as purchased with its button disabled. Inside one subscription group, choosing another plan starts the system upgrade or downgrade flow, which explains the billing effect. The important exception is a lifetime purchase outside that group: buying it does not cancel an active subscription automatically, so your surrounding copy or support flow should tell users to cancel manually if that is their intent. To improve the plain list, return a custom SwiftUI view from the callback so each product can show its own image, add Restore Purchases with the store button modifier, and choose compact, regular or large product rows with productViewStyle. Background and foreground colour tweaks are available, but overall layout control remains limited.
ProductView: one product, full layout control
ProductView renders a single product, which makes it the building block for a bespoke layout. You supply one product ID, optionally return an image view, and set compact, regular or large styling. Because each row is separate, you can mix styles, add padding, rounded material backgrounds and foreground colours, then compose rows into a paywall that matches your app. The tradeoffs are responsibility: ProductView does not provide Restore Purchases, so implement restore yourself, and it shares the lifetime-purchase behaviour described above. Trial eligibility, restore, and upgrade or crossgrade handling also become your work when you leave the more opinionated views.
SubscriptionStoreView: an opinionated subscription picker
SubscriptionStoreView targets one subscription group, initialised by group ID or by a chosen list of product IDs. It will not render the separate lifetime purchase. Out of the box it shows the app icon and group name, selectable plans, trial information, billing explanation and a call to action that adapts to the selection, for example Try It Free when a trial applies and Subscribe otherwise. An existing subscriber sees a badge on the current plan and can still upgrade or downgrade. Use subscriptionStoreButtonLabel to prefer action, displayName, price, multiline or singleline button content, noting these are preferences rather than guarantees across platforms. Add Restore Purchases and Redeem Code with store buttons, and privacy and terms links with the policy destination modifier. The visibleRelationships setting, crossgrade, upgrade or all, controls which related plans are shown to an existing subscriber. For styling, replace the header with your own SwiftUI marketing view, add small per-product icons with subscriptionStoreControlIcon, set a header-only or full-height container background, clear the default material behind the picker and restyle individual picker items.
Decision checklist and remaining work
Use this checklist before committing. If subscriptions and one-time purchases must share one screen, rule out SubscriptionStoreView. If you need a working paywall today and can accept system styling, start with StoreView. If brand fit matters more than speed, build with ProductView and budget time for restore, trial and plan-change logic. If you have one subscription group and want adaptive trial and billing copy, choose SubscriptionStoreView. In every case, plan the non-UI work separately: listen for transaction updates, map entitlements to features, and validate transactions on your server. The views render and start purchases; they do not finish the subscription system for you. An offering-based initializer for StoreView and SubscriptionStoreView is described for iOS 17 in protected modules code0013 and code0014, subject to the owner package dependency recorded privately.
| View | Best fit | Handles automatically | You must add |
|---|---|---|---|
| StoreView | Mixed subscriptions and one-time purchases, fastest setup | Product list, purchase buttons, purchased state, in-group upgrade/downgrade flow, optional Restore Purchases | Manual cancellation guidance after a lifetime purchase; limited styling |
| ProductView | Custom layouts and mixed product types | Single-product rendering and purchase button | Restore Purchases, trial and plan-change logic, lifetime-purchase cancellation guidance |
| SubscriptionStoreView | One subscription group only | Plan picker, adaptive call to action, trial and billing copy, current-plan badge, upgrade/downgrade, optional restore, redeem and policy links | Lifetime or other one-time purchases cannot be shown; styling remains within the picker structure |
Comparison based on the captured guide's example catalogue: one subscription group plus a separate lifetime purchase.
Frequently asked questions
Which StoreKit view should I choose?
StoreView renders a ready-made list from product IDs, including subscriptions and one-time purchases. ProductView renders one product so you can assemble and style each row yourself. SubscriptionStoreView is built around one subscription group, with a picker, adaptive call to action, trial wording and upgrade or downgrade handling.
Can SubscriptionStoreView show a lifetime purchase alongside subscriptions?
No. It is designed for a single subscription group and will not show a separate lifetime purchase. Use StoreView or assemble ProductView rows if subscriptions and one-time purchases must appear together, and tell users to cancel an existing subscription manually after buying a lifetime product because that cancellation is not automatic.
How do restore, redeem and policy links differ?
StoreView can add Restore Purchases with the store button modifier. ProductView does not render that button for you, so you need your own restore flow. SubscriptionStoreView can also add Restore Purchases and Redeem Code, plus privacy and terms destinations.
How much can I customise each view?
Yes, within limits. ProductView gives the most per-row control, including mixing compact, regular and large styles. SubscriptionStoreView lets you replace the header marketing area, add small control icons, change backgrounds and adjust button-label preferences, but its overall picker structure remains fixed. StoreView offers the least styling freedom.
Do StoreKit views replace transaction and entitlement handling?
The views handle presentation and the purchase flow, not the whole subscription backend. You still need to observe transaction updates, decide which features an entitlement unlocks, and validate transactions server-side to reduce fraud.