WrapFast comes with a preconfigured purchases flow of 3 products. In order to get this functional, you need to create them on App Store Connect.
For being able to do this, you need to have created an app.
You can create an app mannualy in the App Store Connect clicking on the + Button. The app Bundle Identifier may be already created by Xcode with the prefix XC
, otherwise you will have to create it manually.
Since Xcode 15, you can create automatically an app directly to App Store Connect. To achieve this, in Xcode:
Product > Archive
Distribute App
TestFlight & App Store
Type the Name, SKU and language. Upload…
<aside> ⚠️ If you receive a mail with this: ITMS-90078: Missing Push Notification Entitlement, just ignore it. It is a known bug from Apple side that may occur when using Firebase in your project. I won’t affect you at all.
</aside>
<aside> 💡 Do you want to learn ASO basics? This FREE book by Matteo Spada, creator of Astro ASO tool is the best way to learn the basics FAST: https://matteospada.gumroad.com/l/dzgmq
</aside>
In App Store Connect, enter in your new app created. You are going to configure the products that will be purchased from your app.
In the left menu:
premium_one_time_purchase
. If you set another different one, remember to change it in RevenueCat later.<aside> ⚠️ If you are building a GPT Wrapper, uncheck the country China Mainland. Apple will reject it as it is forbidden these type of apps by Chinese laws.
</aside>
Set Pricing
Set Localization
Save
Now do the same for Subscriptions. You can find them in the left menu:
First create a Subscription Group.
Create a Subscription Group Localization. This is mandatory!
premium_monthly
Then select the Duration: 1 Month
<aside> ⚠️ Family Sharing is turned off by default. Mind that if you turn it on, you cannot set it off later. You’ll have to create a complete new product. Apple things… ¯\*(ツ)*/¯
</aside>
Localize the product
Save and to the same for Annual Subscription with id ****premium_annual
You have to end up having this subs:
<aside> ⚠️ Don’t care so far about the Missing Metadata warning. Later on, before submitting your app to review, remember to upload a screenshot of every in-app purchase, like this:
</aside>
We need to create a token called Shared Secret to set it later in the RevenueCat Dashboard. To do so, in App Store Connect:
In order to allow RevenueCat communicate with StoreKit API, we need to generate a key. Todo so, in the App Store Connect do this:
If you haven't done so yet, you'll need to request access to the App Store Connect API. In that case, you will also need to generate a random App Store Connect API key. Access level or name of the key here doesn't matter, but the Issuer ID will not show unless a key has been generated.
WrapFast relies on the best existing framework to handle in-app purchases and subscriptions in the easiest and quickest way.
RevenueCat Documentation here
The WrapFast boilerplate comes out of the box with the following pre-configured example offering:
premium
containing the Products:
premium_monthly
premium_annual
premium_one_time_purchase
default
that contains:
This means when you fetch the default
Offering within the app, you get those Packages and you can display the Paywall associated to it.
When an user purchases one of the Products, he is granted with the Entitlement associated to that product. Therefore you can easily check if the user has an Entitlement active to display or not the Premium features within your app.
This logic comes already implemented in the WrapFast boilerplate and it is handled by this two managers:
PurchasesManager
: Handles all the interactions with RevenueCat.
UserManager
: Handles user’s state. In terms of purchases, isSubscriptionActive
is the property used in the project to check whether to display premium features or not.
In order to get this functional, you need to sign up for free in RevenueCat and create a new project.
We will go through it in the following sections.
Create a new project
Click on Apps in the left menu and create an App Store app
Fill the fields with the proper information:
Save Changes
Go to the Api Keys menu on the left and next to your App Name click Show Api Key. Copy it in a safe place, you will need it later to paste in the Xcode project.
<aside>
💡 You will have to paste the RevenueCat API key in Xcode in Const.Purchases.key
within Constants.swift
</aside>
We need to add here the same products that we created in the App Store Connect.