Integrating Customer Center on Unity
Installation
Before integrating the Customer Center in Unity, you need to add the RevenueCatUI package to your project.
Requirements
- RevenueCat Unity SDK installed in your project
- RevenueCatUI package installed (includes Customer Center functionality)
- Unity Editor is not supported for displaying the Customer Center UI
Installation Steps
We provide 2 ways to install RevenueCatUI: via Unity Package Manager (UPM) in the OpenUPM registry (recommended), or as a .unitypackage.
Option 1 (recommended): Install using OpenUPM
-
First, install the core RevenueCat Unity SDK (if not already installed) following the Unity installation guide.
-
Add the OpenUPM scoped registry (if not already added). Go to your project's settings → Package Manager, and add a new scoped registry with URL
https://package.openupm.comand scopes:com.openupmandcom.revenuecat.purchases-unity-ui. -
Go to the Package Manager and from "My Registries", select the RevenueCat UI package and click Install.
If you prefer, you can also use OpenUPM-CLI to add the package through the command line. Install the OpenUPM-CLI if you haven't already, then run openupm add com.revenuecat.purchases-unity-ui.
Option 2: Import the RevenueCatUI Unity package
-
First, install the core RevenueCat Unity SDK (if not already installed) following the Unity installation guide.
-
Download the latest version of PurchasesUI.unitypackage.
-
In Unity, import the downloaded
PurchasesUI.unitypackageto your project.
Integration
Opening the customer center is as simple as:
- Present Customer Center
using System.Threading.Tasks;
using RevenueCatUI;
public class CustomerCenterExample : MonoBehaviour
{
public async Task ShowCustomerCenter()
{
await CustomerCenterPresenter.Present();
}
}
Listening to Customer Center Events
You can listen to Customer Center events by passing a callbacks object to the CustomerCenterPresenter.Present() method.
- Unity
using System.Threading.Tasks;
using RevenueCatUI;
public class CustomerCenterEventsExample : MonoBehaviour
{
public async Task ShowCustomerCenterWithEvents()
{
var callbacks = new CustomerCenterCallbacks
{
OnFeedbackSurveyCompleted = (args) =>
{
// User completed feedback survey: args.FeedbackSurveyOptionId
},
OnShowingManageSubscriptions = () =>
{
// Manage subscriptions screen is displayed
},
OnRestoreCompleted = (args) =>
{
// Restore purchases completed successfully: args.CustomerInfo
},
OnRestoreFailed = (args) =>
{
// Restore purchases failed: args.Error
},
OnRestoreStarted = () =>
{
// Restore purchases process started
},
OnRefundRequestStarted = (args) =>
{
// Refund request started (iOS only): args.ProductIdentifier
},
OnRefundRequestCompleted = (args) =>
{
// Refund request completed (iOS only): args.ProductIdentifier, args.RefundRequestStatus
},
OnManagementOptionSelected = (args) =>
{
// User selected management option: args.Option, args.Url (if custom URL)
},
OnCustomActionSelected = (args) =>
{
// Custom action selected: args.ActionId, args.PurchaseIdentifier
}
};
await CustomerCenterPresenter.Present(callbacks);
}
}
The following events are available:
OnManagementOptionSelected: Called when a user selects a management option (for example, missing purchase, cancel, or custom URL)OnRestoreStarted: Called when the restore process beginsOnRestoreCompleted: Called when the restore process completes successfully (with the newCustomerInfoobject)OnRestoreFailed: Called when the restore process fails (with the error object)OnShowingManageSubscriptions: Called when someone starts the manage subscriptions flowOnFeedbackSurveyCompleted: Called when a user completes a feedback surveyOnRefundRequestStarted: Called when a refund request starts (iOS only)OnRefundRequestCompleted: Called when a refund request completes with status information (iOS only)OnCustomActionSelected: Called when a custom action is selected in the customer center
All callbacks execute on a background thread, not Unity's main thread.
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 and Google Play Store.
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. For Unity you are going to have to configure these promotional offers in both Google Play Console and App Store Connect.
Refer to configuring Google Play Store promotional offers and configuring App Store Connect promotional offers for detailed instructions.
Platform Notes
- The Customer Center UI is only available on iOS and Android device builds.
- Unity Editor is not supported for displaying the Customer Center UI.
- Build to device when testing the Customer Center UI.
Learn more about configuring the Customer Center in the configuration guide.