BlogRight arrowTutorialRight ArrowiOS in-app purchases, part 1: Configuration and adding to the project
BlogRight arrowTutorialRight ArrowiOS in-app purchases, part 1: Configuration and adding to the project

iOS in-app purchases, part 1: Configuration and adding to the project

iOS in-app purchases, part 1: Configuration and adding to the project
Listen to the episode
iOS in-app purchases, part 1: Configuration and adding to the project

Subscriptions are one of the ways to monetize an app. Developers can get a recurrent income and provide users with up to date content. Unlike regular purchases, where Apple takes a 30% commission, this commission reduces to 15% in case the user is subscribed during one year or longer. Important: if the user cancels the subscription, this counter resets in 60 days.

With this article, we start our series of tutorials on integrating in-app purchases into an app. Here is what we’ll be talking about:

  1. iOS in-app purchases, part 1: configuration and adding to the project.
  2. iOS in-app purchases, part 2: initialization and purchases processing.
  3. iOS in-app purchases, part 3: testing purchases in XCode.
  4. iOS in-app purchases, part 4: server-side receipt validation.
  5. iOS in-app purchases, part 5: the list of SKError codes and how to handle them.

In this part we will learn how to:

  • Create purchases in App Store Connect.
  • Configure subscriptions: set a duration, price, trial periods.
  • Get a list of purchases in-app.
⭐️ Download our guide on in-app techniques which will make in-app purchases in your app perfect

Creating purchases

Before implementing your in-app purchases you have to:

  • Pay for the Apple Developer account as a natural person or an entity.
  • Accept all the agreements in App Store Connect. Updated agreements will appear in your App Store Connect account, it’s easy to notice them.

Let’s assume that our app will have two types of subscriptions: monthly and annual. Each of them will have a 7-day free trial.

​​On the application page in App Store Connect, open In-App Purchases tab → Manage. Here you can see the list of created purchases. Click (+) next to the title to create a new purchase.

<img src=“spacer.gif” alt=“”>
Purchase creation interface

​​You’ll see an in-app purchase dialog appear. Select Auto-Renewable Subscription.

<img src=“spacer.gif” alt=“”>
In-app purchase dialogue in App Store Connect. Choose auto-renewable subscription

On the next step, you will be offered to create a Subscription Group.

A Subscription Group is a set of subscriptions with the essential feature: the user cannot activate two subscriptions at the same time from the same group. Besides, all the introductory offers, such as trial subscriptions, are applied directly to the entire group. Groups serve to separate business logic in the application.

Let’s name the group Premium Access. While adding another subscription, the interface will offer you to add it to the existing group. Later you will be able to manage the groups in the In-App Purchases menu → Subscription Groups.

<img src=“spacer.gif” alt=“”>
Creating subscription group in App Store Connect

Next, fill out the details:

  • Reference Name is the title of your subscription in App Store Connect, as well as in Sales section and the reports
  • Product ID is a unique product identifier, which is used in the application code
I would recommend choosing a simple Product ID name, which could give you as much information as possible. It’s better to indicate subscription duration to ease further analytics evaluation.
Creating subscription in App Store Connect

Add the second product following the previous instruction.

In the end, the interface of In-App Purchases tab → Manage will look like this:

<img src=“spacer.gif” alt=“”>
This is how two subscriptions in one app look like
Start for free

Integrate in-app subscriptions in your iOS app in 30 minutes with all side cases

Start for free

Subscription configuration

We added the purchases, but they are not ready yet to be used: status bar indicates Missing Metadata. It means we still haven’t added the information about pricing and subscription duration. We’ll fix it now.

Duration and pricing

Click on the product to configure it.

Create a subscription in App Store Connect
Choose duration and set prices

Here we need to choose a Subscription Duration. In our case, we choose 1 Month or 1 Year. Then go to the Subscription Prices menu.

You can flexibly set prices depending on the country, but we will limit ourselves to automatic prices, in USD. App Store Connect will automatically convert prices into another currency, it’s not clear how it works though. Probably you would want to change the price manually adjusting to your target market.
Create a subscription group in App Store Connect

Free trial

One of the most popular ways to increase subscriptions is a free trial:

A user activates it and uses an application for free. If he doesn’t cancel the subscription, after the trial expires, the user is being charged automatically.

The developers love free trials because they work well. Let’s learn how to enable it.

Click (+) next to the title and choose Create Introductory Offer from the list:

Create a subscription group in App Store Connect

Choose a list of countries.

Create a subscription group in App Store Connect

Choose the offer duration. You can set No End Date if you don’t want to limit yourself.

Create a subscription offer in App Store Connect

On the last step, you need to select an Offer Type.

As you can see in the next screenshot, there are three types:

Pay as you go — a reduced-price use: the user pays a reduced price during the initial period and then becomes a regular subscriber with standard prices.
Pay up front — a prepay use: the user pays a fixed amount of money at once and gets an opportunity to use the app during the determined period, and then also becomes a regular subscriber.
Free — a free trial, after its expiry theuser may become a subscriber.

We choose the third one and set the duration for one week.

Create a subscription offer in App Store Connect

Save settings.

Getting the list of SKProduct

Let’s check if the mobile app sees the purchases and then lay the groundwork for further realization of purchases.

It’s a good rule to create a class singleton for working with StoreKit. Such a class has only one instance in the entire app. A lot of productIdentifiers will store our purchases identifiers:
import StoreKit

class Purchases: NSObject {
   static let default = Purchases()

   private let productIdentifiers = Set(
       arrayLiteral: “barcode_month_subscription”, “barcode_year_subscription”

   private var productRequest: SKProductsRequest?

   func initialize() {

   private func requestProducts() {
       // Will implement later

Only identifiers are not enough.

To fully use the purchases you need to get: price, currency, localization, discounts.

SKProduct class returns all this information and even more. To get this information, we need to request Apple. Create an object SKProductsRequest, assign “delegate” (there you will receive the result). Call the method start(), which initialize an asynchronous procedure:

private func requestProducts() {

       let productRequest = SKProductsRequest(productIdentifiers: productIdentifiers)
       productRequest.delegate = self

       self.productRequest = productRequest

If the operation is successful, productsRequest(didReceive response:) method will be called​, which will contain all the relevant information:

extension Purchases: SKProductsRequestDelegate {
    func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
        guard !response.products.isEmpty else {
            print("Found 0 products")

        for product in response.products {
            print("Found product: \(product.productIdentifier)")

    func request(_ request: SKRequest, didFailWithError error: Error) {
        print("Failed to load products with error:\n \(error)")

If everything is successful, there will be two lines in the log:

Found product: barcode_month_subscription
Found product: barcode_year_subscription

However, if there is an error, then SKProduct with such an ID will not be returned. It may happen if the product has become invalid due to any reason.

That’s it.

The next article will be focused on how to make in-app purchases: open/close transactions, handle errors, validate receipt, and more.

If you liked it, give us on GitHub

Further reading

The Good, the Bad and the Ugly of the App Store commission  cut
The Good, the Bad and the Ugly of the App Store commission cut
December 13, 2020
6 min read
IDFA is gone for good. Can you replace it with Facebook API?
IDFA is gone for good. Can you replace it with Facebook API?
March 1, 2021
8 min read
What’s new with in-app purchases: WWDC 2022
What’s new with in-app purchases: WWDC 2022
June 15, 2022
5 min read