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).
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.
Next:
- Enter the App Name
- Select your App's Primary Language
- Select your App's Bundle ID
- Enter the SKU (Stock Keeping Unit, only visible to you) for your App
- Select Full Access
- Press Create
Create a New Subscription Group
In the Subscriptions tab, press on the Create to create a new Subscription Group.
Enter a "Premium" for the Subscription Group and press Create.
In the App Store Localization Section, press on Create.
Here:
- Enter the Subscription Group Name
- 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)
- Press Create
Add a Yearly Subscription
In the Subscriptions Section, press on Create.
Here:
- Enter a Reference Name (Only visible to you)
- 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:
After creating the subscription, Select the Subscription Duration and click on Set Up Availability.
Select all the countries you want your subscription to be available in and press Done.
Scroll down to the Subscription Prices section and press on Add Subscription Price.
Enter your region, price that you want to charge for your subscription and press Save.
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.
Next, scroll down to App Store Localization and press on Add Localization.
Enter the Display Name and Description for your subscription and press Add. (It is recommended to use the same Display Name and Description)
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 a Monthly Subscription
Back in the Subscription Group Overview, press on the Blue Plus Button to add a new Subscription.
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:
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.
In the Dialog:
- Select Non-Consumable
- Enter a fitting Reference Name
- Enter a Product ID
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.
Write down the Shared Secret and press Done.
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
Enter a Key Name and press Generate.
Next:
- Download the .p8 Key
- Write down the Key ID
- 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
Here:
- Enter a fitting Key Name
- Select App Manager
- Press Generate
After generating the key:
- Download the .p8 Key
- Write down the Key ID
- 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.
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.
Here:
- Enter the App Name
- Enter the App Bundle ID
- Enter the Shared Secret
- Upload the .p8 Access Key
- Enter the Key ID
- Enter the Issuer ID
- Press on Save Changes
Scroll down to App Store Connect API, then:
- Upload the App Store Connect .p8 API Key.
- Enter the Key ID
- Enter the Issuer ID
- Enter the Vendor Number
- Press on Save Changes
Create Entitlements
Next, select Entitlements in the Sidebar and press on New.
Enter the Entitlement Name and enter its Description and press Add.
Create Products
In the Sidebar, select Products press on New. Select App Store.
Here, press on Import Products.
Select all products, and press Import.
After importing the products, you should see them in the Products section:
Go back to the Entitlements section and press on the entitlement.
Press on the Attach Button in Associated Products
Select the first product and press Add.
Select all the other products. In the end you should see all products in the Associated Products section:
Create an Offering & Packages
Creation of an Offering
In the Sidebar, select Offerings and press on New.
Here, enter a "default" as the Offering Identifier and a short Description. Press Save.
Package Creation
Press on the Offering we've just created.
In Packages, press on New.
Here:
- Select Monthly as the Package Identifier
- Enter a Description
- Press Add
After creating a Monthly Package, we must attach a Monthly Product to it. Press on the Package, then Attach
Select the Monthly Product and press Attach.
Do the same for the Yearly and Lifetime packages. In the end, you should see all packages in the Offering:
Create a ReveueCat Paywall
In the Sidebar, select Paywalls and press on Add Paywall button for the Offering we've just created.
Select the second option.
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:
- Enter a Title (Won't be visible in the App)
- Enter a Subtitle (Won't be visible in the App)
In the Packages section:
- Select all Packages we created.
- Select Monthly as the Default Package
- Select Offer period in Package Name
- Enter "Full Access for just {{ price_per_period }}" in Package details
- Enter "First {{ sub_offer_duration }} free, then {{ price_per_period }}" in Package details for an introductory offer
- Enter #3774E6 for Background and #FFFFFF for Text
In the Call to Action section:
- Enter "Subscribe Now" in Call to action
- Enter #3774E6 for Background and #FFFFFF for Text
In the Footer Links section:
- Enter your Terms of Service URL
- 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.
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.
In Xcode, go to Targets > InAppPurchaseKit > Config > RevenueCat-Info and paste the API Key into the value property of the key 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.
To test the subscription functionality, you need to create an Apple Sandbox Account (opens in a new tab).