setup static method
- @Deprecated('Use PurchasesConfiguration')
- String apiKey, {
- String? appUserId,
- PurchasesAreCompletedBy? purchasesAreCompletedBy,
- String? userDefaultsSuiteName,
- StoreKitVersion? storeKitVersion,
- bool useAmazon = false,
- bool usesStoreKit2IfAvailable = false,
Sets up Purchases with your API key and an app user id.
apiKey
RevenueCat API Key.
appUserID An optional unique id for identifying the user.
purchasesAreCompletedBy
Set this to PurchasesAreCompletedByMyApp and provide a StoreKitVersion if you
have your own IAP implementation and want to only use RevenueCat's backend.
Defaults to PurchasesAreCompletedByRevenueCat.
If you are on Android and setting this to PurchasesAreCompletedByMyApp, you will have to acknowledge the purchases yourself. If your app is only on Android, you may specify any StoreKitVersion, as it is ignored by the native Android SDK.
userDefaultsSuiteName
iOS-only, will be ignored for Android.
Set this if you would like the RevenueCat SDK to store its preferences in a different
NSUserDefaults suite, otherwise it will use standardUserDefaults.
Default is null, which will make the SDK use standardUserDefaults.
useAmazon
Android only. Set this to true if you are building the app
to be distributed in the Amazon Appstore
usesStoreKit2IfAvailable
iOS-only, will be ignored for Android.
RevenueCat currently uses StoreKit 1 for purchases, as its stability in production scenarios has
proven to be more performant than StoreKit 2.
We're collecting more data on the best approach, but StoreKit 1 vs StoreKit 2 is an implementation detail that you shouldn't need to care about.
Simply leave this parameter as default to let RevenueCat decide for you which StoreKit implementation to use. Set this to FALSE to disable StoreKit2.
Implementation
/// [usesStoreKit2IfAvailable] iOS-only, will be ignored for Android.
/// RevenueCat currently uses StoreKit 1 for purchases, as its stability in production scenarios has
/// proven to be more performant than StoreKit 2.
///
/// We're collecting more data on the best approach, but StoreKit 1 vs StoreKit 2 is an implementation detail
/// that you shouldn't need to care about.
///
/// Simply leave this parameter as default to let RevenueCat decide for you which StoreKit implementation to use.
/// Set this to FALSE to disable StoreKit2.
@Deprecated('Use PurchasesConfiguration')
static Future<void> setup(
String apiKey, {
String? appUserId,
PurchasesAreCompletedBy? purchasesAreCompletedBy,
String? userDefaultsSuiteName,
StoreKitVersion? storeKitVersion,
bool useAmazon = false,
bool usesStoreKit2IfAvailable = false,
}) {
final configuration = PurchasesConfiguration(apiKey)
..appUserID = appUserId
..purchasesAreCompletedBy =
purchasesAreCompletedBy ?? const PurchasesAreCompletedByRevenueCat()
..userDefaultsSuiteName = userDefaultsSuiteName
..storeKitVersion = storeKitVersion ?? StoreKitVersion.defaultVersion
..store = useAmazon ? Store.amazon : null;
_lastReceivedCustomerInfo = null;
return configure(configuration);
}