Project Setup
InAppPurchaseKit Setup

InAppPurchaseKit Setup

⚠️

In order to activate In-App Purchases, you must have an active Apple Developer Program Membership (opens in a new tab) and have signed the Paid Applications Agreement (opens in a new tab). App Store Connect Agreements

Setting up the Products in App Store Connect

Create a New App in App Store Connect

At first, we need to create a new App in App Store Connect. Go to Apps (opens in a new tab) in App Store Connect and press on the Plus Button.

App Store Connect Apps

Next:

  1. Enter the App Name
  2. Select your App's Primary Language
  3. Select your App's Bundle ID
  4. Enter the SKU (Stock Keeping Unit, only visible to you) for your App
  5. Select Full Access
  6. Press Create

App Store Connect New App

Create a New Subscription Group

In the Subscriptions tab, press on the Create to create a new Subscription Group.

App Store Connect New Subscription Group

Enter a "Premium" for the Subscription Group and press Create.

App Store Connect New Subscription Group Name Enter

In the App Store Localization Section, press on Create.

App Store Subscription Group Initial View

Here:

  1. Enter the Subscription Group Name
  2. Select Use Custom Name and enter App's name. (You might want to change the App's Name later to something like "MyCookbookApp - Best Recipies" and we wouldn't want that to change the Subscriptoins Name)
  3. Press Create

New Subscription Group Localization

Name Explainer

Add a Yearly Subscription

In the Subscriptions Section, press on Create.

New Subscription

Here:

  1. Enter a Reference Name (Only visible to you)
  2. Enter a product ID. It is recommended to follow RevenueCat guidelines to make it easily recognizable using following format: app_price_duration.

RevenueCat Guidelines for the Product ID: RevenueCat Suggestions

Enter New Subscription Name

After creating the subscription, Select the Subscription Duration and click on Set UpAvailability.

Select Duration and Availability of a Subscription

Select all the countries you want your subscription to be available in and press Done.

Select Region Availability of a Subscription

Scroll down to the Subscription Prices section and press on Add Subscription Price.

Select Price

Enter your region, price that you want to charge for your subscription and press Save.

Select Price

If you want your subscription to be cheaper/more expensive dependindg on the region, you can select that here. When you're done press on Next.

Select Price Change Depending on Region

Next, scroll down to App Store Localization and press on Add Localization.

Add Localization Button

Enter the Display Name and Description for your subscription and press Add. (It is recommended to use the same Display Name and Description)

Subscription Display Name Enter

Then, add a Reviewer Screenshot, which should display your App's Paywall. It is required for the review process, but for now we can just use placeholder image. You can download one here.

Press on Save

Add Reviewer Screenshot

Add a Monthly Subscription

Back in the Subscription Group Overview, press on the Blue Plus Button to add a new Subscription.

Create Monthly Sub

Follow the same steps as in the Yearly Subscription to create a Monthly Subscription.

If everything is set up correctly, you should see two subscriptions in the Subscription Group Overview:

Yearly and Monthly Subscriptions

Add a Life-Time Access Product

Here we will add a one-time purchase to grant the user a lifetime access to the app.

In the Sidebar, select In-App Purchases, press on Create.

New In-App Purchase

In the Dialog:

  1. Select Non-Consumable
  2. Enter a fitting Reference Name
  3. Enter a Product ID

New In-App Purchase Information Entry

In App Store Localization enter Lifetime Premium Access. Select Availability, Pricing, and Review Screenshot the same way as with the Subscriptions.

Create an App-Specific Shared Secret

In order for RevenueCat to communicate with App Store Connect, we need to create an App-Specific Shared Secret. In the Sidebar select App Information, scroll down to App-Specific Shared Secret and press on Manage.

Press on Generate.

Create New Shared Secret

Write down the Shared Secret and press Done.

Generated Shared Secret Dialog

Generate a .p8 IAP Access Key

Go to the In-App Purchase (opens in a new tab) Section in App Store Connect > Users and Access > Integrations

Press on the Plus Button to create a new Key

Create New IAP Access Key

Enter a Key Name and press Generate.

New Key Name

Next:

  1. Download the .p8 Key
  2. Write down the Key ID
  3. Write down the Issuer ID

Generate a .p8 App Store Connect API Key

Go to the App Store Connect API (opens in a new tab) Section in App Store Connect > Users and Access > Integrations

Press on the Plus Button to create a new Key

Create New App Store Connect API Key

Here:

  1. Enter a fitting Key Name
  2. Select App Manager
  3. Press Generate

Generate API Key

After generating the key:

  1. Download the .p8 Key
  2. Write down the Key ID
  3. Write down the Issuer ID

Then, go to your App Store Connect Payments and Financial Reports (opens in a new tab) page and write down your Vendor Number, located in the top left corner.

Get App Store Connect Vendor ID

Connect Products to RevenueCat

If you haven't already, create a RevenueCat Account (opens in a new tab).

In the RevenueCat Dashboard (opens in a new tab), create a new project.

Select App Store.

RC Dashboard

Here:

  1. Enter the App Name
  2. Enter the App Bundle ID
  3. Enter the Shared Secret
  4. Upload the .p8 Access Key
  5. Enter the Key ID
  6. Enter the Issuer ID
  7. Press on Save Changes

RC Data Entry

Scroll down to App Store Connect API, then:

  1. Upload the App Store Connect .p8 API Key.
  2. Enter the Key ID
  3. Enter the Issuer ID
  4. Enter the Vendor Number
  5. Press on Save Changes

RevenueCat Upload App Store Connect API Key

Create Entitlements

Next, select Entitlements in the Sidebar and press on New.

New RevenueCat Entitlement

Enter the Entitlement Name and enter its Description and press Add.

RevenueCat Entitlement Name Creation

Create Products

In the Sidebar, select Products press on New. Select App Store.

RevenueCat Product List RevenueCat New Product Select Platform

Here, press on Import Products.

RevenueCat Import Products from App Store Connect

Select all products, and press Import.

RevenueCat Select Products to Import from App Store Connect

After importing the products, you should see them in the Products section:

RevenueCat Imported Products

Go back to the Entitlements section and press on the entitlement.

Attach Products to Entitlements 1

Press on the Attach Button in Associated Products

Attach Products to Entitlements 2

Select the first product and press Add.

Attach Products to Entitlements 3

Select all the other products. In the end you should see all products in the Associated Products section:

Attach Products to Entitlements 4

Create an Offering & Packages

Creation of an Offering

In the Sidebar, select Offerings and press on New.

New RevenueCat Offering

Here, enter a "default" as the Offering Identifier and a short Description. Press Save.

 RevenueCat Offering Creation

Package Creation

Press on the Offering we've just created.

 RevenueCat Created Offerings

In Packages, press on New.

RevenueCat Offering Settings

Here:

  1. Select Monthly as the Package Identifier
  2. Enter a Description
  3. Press Add

RevenueCat Package Data Input

After creating a Monthly Package, we must attach a Monthly Product to it. Press on the Package, then Attach

New RevenueCat Newly Created Package New RevenueCat Created Package Settings

Select the Monthly Product and press Attach.

RevenueCat Attach Product to Package

Do the same for the Yearly and Lifetime packages. In the end, you should see all packages in the Offering:

RevenueCat all created packages

Create a ReveueCat Paywall

In the Sidebar, select Paywalls and press on Add Paywall button for the Offering we've just created.

RevenueCat New Paywall

Select the second option.

RevenueCat Paywall Template Selection

We recommend you to follow these steps exactly. During Project Generation, SwiftyLaunch creates a custom paywall, which relies on this paywall. We need this for convenient auto-update of the paywall in the App. If you want to alter the paywall, do it carefully, piece by piece, to reduce the risk of chatoic UI.

In the Main Content section, enter:

  1. Enter a Title (Won't be visible in the App)
  2. Enter a Subtitle (Won't be visible in the App)

RevenueCat Paywall Creation Step 1

In the Packages section:

  1. Select all Packages we created.
  2. Select Monthly as the Default Package
  3. Select Offer period in Package Name
  4. Enter "Full Access for just {{ price_per_period }}" in Package details
  5. Enter "First {{ sub_offer_duration }} free, then {{ price_per_period }}" in Package details for an introductory offer
  6. Enter #3774E6 for Background and #FFFFFF for Text

RevenueCat Paywall Creation Step 2

In the Call to Action section:

  1. Enter "Subscribe Now" in Call to action
  2. Enter #3774E6 for Background and #FFFFFF for Text

RevenueCat Paywall Creation Step 3

In the Footer Links section:

  1. Enter your Terms of Service URL
  2. Enter your Privacy Policy URL

You can enter placeholder URL for now. But you must include them somewhere in your App to comply with the App Store Review Guidelines in order to publish your App.

RevenueCat Paywall Creation Step 4

Press on Create Paywall.

Connect RevenueCat with our App

Now, we'll copy the a RevenueCat API Key to our App to be able to show our Offerings via our Paywall.

Back in the RevenueCat Dashboard, select API Keys in the Sidebar.

In the Public app-specific API keys section, press on Show Key. Write down the API Key.

RevenueCat API Key

In Xcode, go to Targets > InAppPurchaseKit > Config > RevenueCat-Info and paste the API Key into the value property of the key REVENUECAT_API_KEY.

Xcode Paste RevenueCat API Key

Test if everything is set up correctly

It's recommended to wait until you have set up the rest of your app before doing any tests, but if you can't wait, you can temporarily disable other frameworks.

Run your app on a real device or a simulator. Select the Settings Tab. Press on Unlock Premium Features. If everything is set up correctly, you should be able to see the Paywall with the packages, that you've created.

App Test Images, Settings screen and Paywall

To test the subscription functionality, you need to create an Apple Sandbox Account (opens in a new tab).