How to implemet a free trial period for StoreKit 2 subscriptions in iOS
Learn how to implement StoreKit 2 introductory offers.
13 Nov 2023 · 2 min read
When setting up auto-renewable subscriptions for an iOS application with StoreKit 2, we might want to offer users a free trial period.
Let's look at how to do that.

Setting up a subscription with a free trial
When setting up a StoreKit subscription in App Store Connect or via a StoreKit test file, we have the possibility to setup an introductory offer.

As shown above, we can choose between 3 options:
- Pay as you go - new subscribers pay an introductory price each billing period for a specific duration, for example 0.99 € per month for 3 months. After 3 months, subscribers pay the regular monthly price.
- Pay up front - new subscribers pay a one-time introductory price for a specific duration, for example 0.99 € for 1 month. After 1 month, subscribers pay the regular monthly price.
- Free trial - new subscribers access content for free for a specified duration. After the free trial period is over, they pay the regular price.
In our case, we choose the free trial option and select the duration of the free trial period.
Showing the free trial options in the iOS app
After setting up the free trial, the next step is to show it to eligible users. A user is not eligible if they already used an introductary offer of that subscription or a subscription of the same group before.
We can use the subscription's introductoryOffer property that will automatically be applied if the user is eligible. Alternatively, we can use the isEligibleForIntroOffer property on the subscription to check if the user is eligible:
func isEligibleForFreeTrial() async -> Bool {guard let subscription = product?.subscription else { return false }return await subscription.isEligibleForIntroOffer}
The subscription's introductoryOffer offers different properties which represent the information we configured, for example:
- introductoryOffer.paymentMode represents the configured payment option which may be payAsYouGo, payUpFront or freeTrial
- introductoryOffer.period represents the period of the introductary offer
If we decide to offer another option such as payAsYouGo or payUpFront, we can also use properties like displayPrice or periodCount to show relevant information to the user.

Newsletter
Like to support my work?
Say hi
Related tags
Articles with related topics
Latest articles and tips