StoreKit2 In-App Purchases
Learn how to integrate StoreKit2 in-app purchases
Adding In-App Purchases in App Store Connect
First Create a New App
Before adding in-app purchases, you need to create your App first, this is required. We log in to App Store Connect, click "Apps" at the top, then click the "+" button to create your App.

In the New App popup, you need to fill in the following information:
- Platform: Select your App's platform
The platform you expect to launch on. Choose iOS, which can be downloaded on both iPhone and iPad ( the premise is that you need to adapt for iPad)
-
App Name: Your App's name
-
Bundle ID: Your App's Bundle ID
You can select from the dropdown. Please select the Bundle ID corresponding to your XCode project.

-
Fill in SKU information ( this information is only visible to you) can be filled with the App name
-
Access selection: Full Access
-
Click the Create button
Auto-renewable subscriptions depend on subscription groups, so you need to create a subscription group first.
Create Subscription Group
- Select
Subscriptionson the left, click theCreatebutton to create a new subscription group

- Fill in your subscription group name, mostly names like
Pro,Plus,VIP,Premium,Unlimited, etc. Then click theCreatebutton

- Fill in subscription group internationalization information. We'll use English/Chinese as an example, fill in the English subscription group name and subscription group description.

Subscription group internationalization information will automatically display the corresponding language in the AppStore based on the user's region.
The image below shows subscription group related information

- First step: Localization: Select the corresponding language
- Second step: Fill in the subscription group name
- Third step: App Name Display Options select: Use Custom Name, because you might modify the App name later, so choose Use Custom Name here
- Fourth step: Create to save

Taking Chinese as an example

After creation is complete, you can view and manage internationalization information here

Create Subscriptions under Subscription Group
In most cases, the subscriptions we create are auto-renewable subscriptions, which are the common annual subscriptions ( annual payment/membership), monthly subscriptions( monthly payment/membership), or weekly subscriptions( weekly payment/membership).
So we'll take annual subscription and monthly subscription as examples. Similarly, you can create weekly subscriptions. The steps are all the same
Create Annual Subscription
1. Create Subscription Type

Next, the system will ask you to provide a reference name and product ID
We need to explain Reference Name and Product ID to help you better understand App Store Connect related knowledge
-
Reference Name: The Reference Name will be used in App Store Connect and Apple's Sales and Trends reports, but will not be displayed to users in the App Store. It's recommended to use an easy-to-understand product description as the name, and the length must not exceed 64 characters.
-
Product ID: The product ID is a unique alphanumeric identifier used to access your product in development and sync with RevenueCat. Once you use a product ID for a product in App Store Connect, that ID cannot be used for any other applications you create in the future, even if the product is deleted. It's recommended to stay organized from the start—we recommend using a consistent naming scheme for all product identifiers, such as:
<app>_<price>_<duration>_<intro duration><intro price>
Let's further explain the above specification:
- app (application prefix): This is a unique prefix exclusive to your application, because the same product ID cannot be used for any other applications you create in the future.
- price (price): The fee you plan to charge for this product in the default currency.
- duration (subscription duration): The duration of the regular subscription cycle.
- intro duration ( trial duration): If there's a trial period, this represents the duration of the trial period.
- intro price ( trial price): If there's a trial period, this represents the trial price in the default currency.
In this example, I want to set up an annual subscription priced at $69. Following this format, I set the product identifier to:
easyappswiftui_69_1y

Using a consistent naming scheme for product identifiers in App Store Connect will save you time in the future and make it easier to organize and understand your products just by their identifiers.
2. Set Subscription Duration
After clicking Save in the previous step, we need to set the subscription duration. For annual membership, we select 1 year validity period
Then set Availability
Availability means selecting which countries/regions your subscription service is effective in.

We of course hope that all countries/regions can use our subscription service, so here we check all by default.
Click the Save button to save

3. Set Subscription Price
Scroll the webpage to find Subscription Prices, click the Add Subscription Prices button to set subscription prices

In the popup, we need to set 2 pieces of information
- First part: Select country/region
- Second part: Select price

For country, we first choose the United States, settled in US dollars
For price, we choose $69
If you want to find more price options, click the See Additional Prices button and select your desired price

Then click the Next button

Next, you'll see another popup
In this popup, you can set different prices based on country/region. For example, I set it to ¥128 RMB for mainland China region

Similarly, you can also click the See Additional Prices button and select your desired price
Here, App Store Connect is very thoughtful and will automatically calculate corresponding prices for other countries/regions based on the US dollar price you set combined with current exchange rates.
After setting is complete, click the Next button and click the Confirm button
4. Set Subscription Internationalization Information
Next, you need to set the App Store localization information. These are the in-app purchase names and descriptions that users will see.
Continue scrolling down the webpage, find Localization, click the Add Localization button

We need to provide subscription display name and description. The subscription display name and description will be displayed in the App Store and user's subscription management settings.
Taking the annual subscription we just created as an example: Our subscription name is Annual Subscription, and the subscription description is Unlimited access unlocks all features
In the document, we'll use English and Chinese as examples
First, set the English subscription display name and description
After filling in, click the Add button

Now set the Chinese subscription display name and description
- Select Chinese
- Subscription display name: 年度订阅
- Subscription description: 解锁所有高级功能

After filling in, click the Add button
After creation is complete, you can view and manage internationalization information here

5. Add Review Information
Continue scrolling down the webpage to find Review Information
The final step in setting up in-app purchases in iOS is to add information for reviewers. This includes a screenshot and optional review notes. Developers often overlook the screenshot, but without it, the product cannot be submitted for review.
- Screenshot: The in-app purchase paywall for reviewers to view. During testing, you can upload any 640×920 blank image here. Before submitting for review, be sure to replace it with the actual paywall interface image.
- Review Notes: This is optional and used to explain anything related to in-app purchases to reviewers. ( Most cases don't need to fill this in)

During testing, you can download this image and upload it as a placeholder. Before submitting for review, be sure to replace it with the actual paywall image.

After setting is complete, click the Save button in the top right corner to save. At this point, the annual subscription creation is complete.
Next, we'll follow the steps for creating annual subscriptions to create monthly subscriptions.
Create Monthly Subscription
We return to the subscription group preview page, click the Subscriptions + button to create a monthly subscription

At this point, the steps are exactly the same as Create Annual Subscription.
You can refer to the steps for Create Annual Subscription to create monthly subscriptions
Of course, you can also create weekly subscriptions, quarterly subscriptions, semi-annual subscriptions. Their steps are all the same.
Remember to select the correct subscription duration here 😄

If you complete the entire process smoothly, you should see the following page. All subscriptions you create will be displayed here.

If you want to modify subscription information, you can click the subscription name to enter the subscription details page. Then modify the information you expect.

We cannot modify the subscription's Product ID. Even if the product is deleted, this ID cannot be used for any other applications you create in the future. This is the unique identifier for obtaining subscription information. If you're not sure, please refer to the Product ID explanation in here.
Create One-Time Purchase ( Lifetime Membership)
Creating one-time purchases does not depend on subscription groups. We return to the preview App homepage, click In-App Purchases, click the Create button to create a one-time purchase

In the popup, we need to fill in the following information:

- Type: Select
Non-Consumable, representing non-consumable products
Let me give you an example to help you understand: Non-consumable products can be understood this way: for example, we develop an image recognition app, after users purchase lifetime membership, they can use this feature permanently. No usage limits, no time limits.
Consumable products: for example, we set that users can purchase 100 recognition opportunities, then after users purchase, they can use this feature permanently. But when the usage is exhausted, users need to purchase again.
-
The filling of
Reference NameandProduct IDfollows the same rules as in Create Annual Subscription. -
Click the
Createbutton to create a one-time purchase and enter the one-time purchase details page
Similarly, we need to set the one-time purchase's Availability, Price Schedule, App Store Localization, Review Information according to the rules for Create Annual Subscription

Finally, don't forget to click the Save button in the top right corner to save
After success, you can view and manage one-time purchases here

Congratulations 🎉🎉🎉, at this point, you have completed the creation of subscription in-app purchases and one-time purchases in App Store Connect.
Configuring StoreKit2 in EasyApp
After completing the in-app purchase configuration in App Store Connect, you need to configure StoreKit2's productIDs in EasyApp.
Open the EasyAppSwiftUI/Constants/Constants.swift file, find the Constants -> StoreKit2 enum, and configure your productIDs.
Where productIDs are the in-app purchase productIDs you configured in App Store Connect.

enum Constants {
// ... other configurations
/// StoreKit2 product IDs
/// Enter the product ID from App Store Connect here
enum StoreKit2 {
static let productIDs = ["your product ids"]
}
// ... other configurations
}Reminder
There's another place where errors can easily occur - the agreement configured in App Store Connect must be correct.
Please ensure that the information in the screenshot such as [Paid Apps Agreement], [Bank Account], [Tax Forms] are all correct, otherwise it will lead to review failure and in-app purchase integration failure.
Testing In-App Purchases
During the development phase, in-app purchases are all tested in the sandbox environment. When making purchases, no actual charges will be made.
Please use a real device for testing, do not use the simulator.
- First, we need to create a sandbox test account in App Store Connect's
Users and Access
If you already have a test account, follow the image below:

Click the + button to create a sandbox test account,
If you don't have a test account and are creating for the first time, please follow the image below:

In the subsequent popup, enter your test account related information, then click the Create button to save.

-
Run the App on a real device, in-app purchase testing

Reminder
We have only completed the configuration steps for in-app purchases. At this time, when users make purchases, there is no interaction with the backend, such as updating user membership status, updating user subscription information, etc. You need to handle this accordingly in the supabase backend.
Regarding this part, the template implements this functionality using the credits feature. If you have business needs in this area in the future, you can refer to the implementation of the credits feature in the template.
Last updated on