Integrating Customer Center on iOS
Overviewโ
Customer Center is a self-service UI that can be added to your app to help your customers manage their subscriptions on their own. With it, you can prevent churn with pre-emptive promotional offers, capture actionable customer data with exit feedback prompts, and lower support volumes for common inquiries โ all without any help from your support team.
There are only three steps to integrate Customer Center in your app:
- Installing the RevenueCat UI SDK in your app
- Implementing the Customer Center view in your app
- Setting up promotional offers in App Store Connect/Google Play Console
Installationโ
Before integrating the Customer Center in iOS, you need to add the RevenueCatUI SDK 5.14.0
or higher to your app.
Using SPMโ
If you already have RevenueCat
in your project:โ
- Open your project settings and select "Package Dependencies":
- Double-click and make sure version is at least
5.14.0
:
- Open your target settings and find "Frameworks, Libraries, and Embedded Content":
- Add
RevenueCatUI
:
First time integrating the RevenueCat SDK:โ
-
Click File -> Add Packages...
-
Search for
git@github.com:RevenueCat/purchases-ios.git
and make sure version is at least5.14.0
:
- Add
RevenueCat
andRevenueCatUI
SPM dependency to your project:
Using CocoaPodsโ
Add the following to your Podfile
:
pod 'RevenueCat'
pod 'RevenueCatUI'
Integrationโ
You can use the CustomerCenterView
directly:
- SwiftUI
import RevenueCatUI
...
var body: some View {
Group {
NavigationStack {
HomeView()
.navigationTitle("Home")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button {
} label: {
Image(systemName: "line.3.horizontal")
}
}
ToolbarItem(placement: .topBarTrailing) {
Button {
self.isCustomerCenterPresented = true
} label: {
Image(systemName: "person.crop.circle")
}
}
}
}
}
.foregroundColor(.white)
.sheet(isPresented: $isCustomerCenterPresented) {
CustomerCenterView()
}
}
Or via a modifier:
- SwiftUI
import RevenueCatUI
...
VStack {
Button {
self.presentingCustomerCenter = true
} label: {
TemplateLabel(name: "Customer Center", icon: "person.fill")
}
}
.presentCustomerCenter(isPresented: self.$presentingCustomerCenter) {
self.presentingCustomerCenter = false
}
Listening to eventsโ
We've added a way to listen to events that occur within the CustomerCenterView
. For now, we are not posting any event to our backend (like feedback survey selections). We are going to be adding way more events in the future, but these are what are available for now:
- Swift
CustomerCenterView { customerCenterAction in
switch customerCenterAction {
case .restoreStarted:
case .restoreFailed(_):
case .restoreCompleted(_):
case .showingManageSubscriptions:
case .refundRequestStarted(_):
case .refundRequestCompleted(_):
}
}
If using the modifier:
- Swift
.presentCustomerCenter(
isPresented: self.$presentingCustomerCenter,
customerCenterActionHandler: { action in
switch action {
case .restoreCompleted(let customerInfo):
case .restoreStarted:
case .restoreFailed(let error):
case .showingManageSubscriptions:
case .refundRequestStarted(let productId):
case .refundRequestCompleted(let status):
case .feedbackSurveyCompleted(let surveyOptionID):
}
}
) {
self.presentingCustomerCenter = false
}
Setup promotional offersโ
Promotional Offers allow developers to apply custom pricing and trials to new customers and to existing and lapsed subscriptions. Unique promotional offers can be assigned to different paths and survey responses in the Customer Center, but first they must be setup in App Store Connect.
The Customer Center will automatically show offers based on specific user actions. By default we have defined it for cancellations but it can be modified to any of the defined paths. Refer to configuring App Store Connect promotional offers for detailed instructions.
Learn more about configuring the Customer Center in the configuration guide.