Purchases class
Entry point for Purchases.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
Static Methods
-
addCustomerInfoUpdateListener(
CustomerInfoUpdateListener customerInfoUpdateListener) → void - Sets a function to be called on updated customer info.
-
addReadyForPromotedProductPurchaseListener(
ReadyForPromotedProductPurchaseListener listener) → void - iOS only Sets a listener to be called when a user initiates a promoted in-app purchase from the App Store.
-
beginRefundRequestForActiveEntitlement(
) → Future< RefundRequestStatus> - iOS 15+ only. Presents a refund request sheet in the current window scene for the latest transaction associated with the active entitlement.
-
beginRefundRequestForEntitlement(
EntitlementInfo entitlement) → Future< RefundRequestStatus> -
iOS 15+ only. Presents a refund request sheet in the current window scene for
the latest transaction associated with the
entitlement
. -
beginRefundRequestForProduct(
StoreProduct product) → Future< RefundRequestStatus> -
iOS 15+ only. Presents a refund request sheet in the current window scene for
the latest transaction associated with the
product
-
canMakePayments(
[List< BillingFeature> features = const []]) → Future<bool> - Check if billing is supported for the current user (meaning IN-APP purchases are supported) and optionally, whether a list of specified feature types are supported.
-
checkTrialOrIntroductoryPriceEligibility(
List< String> productIdentifiers) → Future<Map< String, IntroEligibility> > - iOS only. Computes whether or not a user is eligible for the introductory pricing period of a given product. You should use this method to determine whether or not you show the user the normal product price or the introductory price. This also applies to trials (trials are considered a type of introductory pricing).
-
close(
) → Future< void> - Android only. Call close when you are done with this instance of Purchases to disconnect from the billing services and clean up resources
-
collectDeviceIdentifiers(
) → Future< void> - Automatically collect subscriber attributes associated with the device identifiers $idfa, $idfv, $ip on iOS $gpsAdId, $androidId, $ip on Android
-
configure(
PurchasesConfiguration purchasesConfiguration) → Future< void> - Sets up Purchases with your API key and an app user id.
-
enableAdServicesAttributionTokenCollection(
) → Future< void> - iOS only. Enable automatic collection of Apple Search Ad attribution. Disabled by default
-
getCustomerInfo(
) → Future< CustomerInfo> - Gets current customer info, which will normally be cached.
-
getOfferings(
) → Future< Offerings> - Fetch the configured offerings for this users. Offerings allows you to configure your in-app products via RevenueCat and greatly simplifies management. See the guide for more info.
-
getProducts(
List< String> productIdentifiers, {PurchaseType type = PurchaseType.subs}) → Future<List< StoreProduct> > - Fetch the product info. Returns a list of products or throws an error if the products are not properly configured in RevenueCat or if there is another error while retrieving them.
-
getPromotionalOffer(
StoreProduct product, StoreProductDiscount discount) → Future< PromotionalOffer> - iOS only.
-
handleLogHandlerEvent(
MethodCall call) → void -
invalidateCustomerInfoCache(
) → Future< void> - Invalidates the cache for customer information.
-
logIn(
String appUserID) → Future< LogInResult> - This function will logIn the current user with an appUserID. Typically this would be used after logging in a user to identify them without calling configure
-
logOut(
) → Future< CustomerInfo> - Logs out the Purchases client, clearing the saved appUserID. This will generate a random user id and save it in the cache.
-
presentCodeRedemptionSheet(
) → Future< void> - iOS only. Presents a code redemption sheet, useful for redeeming offer codes Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how to configure and use offer codes
-
purchaseDiscountedPackage(
Package packageToPurchase, PromotionalOffer promotionalOffer) → Future< CustomerInfo> - iOS only. Purchase a package applying a given promotional offer.
-
purchaseDiscountedProduct(
StoreProduct product, PromotionalOffer promotionalOffer) → Future< CustomerInfo> - iOS only. Purchase a product applying a given promotional offer.
-
purchasePackage(
Package packageToPurchase, {UpgradeInfo? upgradeInfo}) → Future< CustomerInfo> -
Makes a purchase. Returns a
CustomerInfo
object. Throws a PlatformException if the purchase is unsuccessful. Check if PurchasesErrorHelper.getErrorCode is PurchasesErrorCode.purchaseCancelledError to check if the user cancelled the purchase. -
purchaseProduct(
String productIdentifier, {UpgradeInfo? upgradeInfo, PurchaseType type = PurchaseType.subs}) → Future< CustomerInfo> -
Makes a purchase. Returns a
CustomerInfo
object. Throws a PlatformException if the purchase is unsuccessful. Check if PurchasesErrorHelper.getErrorCode is PurchasesErrorCode.purchaseCancelledError to check if the user cancelled the purchase. -
removeCustomerInfoUpdateListener(
CustomerInfoUpdateListener listenerToRemove) → void - Removes a given CustomerInfoUpdateListener
-
removeReadyForPromotedProductPurchaseListener(
ReadyForPromotedProductPurchaseListener listenerToRemove) → void - iOS only Removes a given ReadyForPromotedProductPurchaseListener
-
restorePurchases(
) → Future< CustomerInfo> - Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.
-
setAd(
String ad) → Future< void> - Subscriber attribute associated with the install ad for the user
-
setAdGroup(
String adGroup) → Future< void> - Subscriber attribute associated with the install ad group for the user
-
setAdjustID(
String adjustID) → Future< void> - Subscriber attribute associated with the Adjust Id for the user Required for the RevenueCat Adjust integration
-
setAirshipChannelID(
String airshipChannelID) → Future< void> - Subscriber attribute associated with the Airship Channel Id for the user Required for the RevenueCat Airship integration
-
setAllowSharingStoreAccount(
bool allowSharing) → Future< void> - Deprecated. Configure behavior through the RevenueCat dashboard instead. Set this to true if you are passing in an appUserID but it is anonymous.
-
setAppsflyerID(
String appsflyerID) → Future< void> - Subscriber attribute associated with the Appsflyer Id for the user Required for the RevenueCat Appsflyer integration
-
setAttributes(
Map< String, String> attributes) → Future<void> - ================================================================================ Subscriber Attributes
-
setAutomaticAppleSearchAdsAttributionCollection(
bool enabled) → Future< void> - iOS only. Enable automatic collection of Apple Search Ad attribution. Disabled by default
-
setCampaign(
String campaign) → Future< void> - Subscriber attribute associated with the install campaign for the user
-
setCleverTapID(
String cleverTapID) → Future< void> - Subscriber attribute associated with the Clever Tap Id for the user Required for the RevenueCat CleverTap integration
-
setCreative(
String creative) → Future< void> - Subscriber attribute associated with the install ad creative for the user
-
setDebugLogsEnabled(
bool enabled) → Future< void> - Enables/Disables debugs logs
-
setDisplayName(
String displayName) → Future< void> - Subscriber attribute associated with the display name for the user
-
setEmail(
String email) → Future< void> - Subscriber attribute associated with the email address for the user
-
setFBAnonymousID(
String fbAnonymousID) → Future< void> - Subscriber attribute associated with the Facebook SDK Anonymous Id for the user Recommended for the RevenueCat Facebook integration
-
setFinishTransactions(
bool finishTransactions) → Future< void> -
finishTransactions
The value to be passed to finishTransactions. -
setFirebaseAppInstanceId(
String firebaseAppInstanceId) → Future< void> - Subscriber attribute associated with the Firebase Instance Id for the user Required for the RevenueCat Firebase integration
-
setKeyword(
String keyword) → Future< void> - Subscriber attribute associated with the install keyword for the user
-
setLogHandler(
LogHandler logHandler) → Future< void> - Set a custom log handler for redirecting logs to your own logging system. By default, this sends info, warning, and error messages. If you wish to receive Debug level messages, see setLogLevel.
-
setLogLevel(
LogLevel level) → Future< void> - Configures log level Used to set the log level. Useful for debugging issues with the lovely team @RevenueCat. The default is {LOG_LEVEL.INFO} in release builds and {LOG_LEVEL.DEBUG} in debug builds.
-
setMediaSource(
String mediaSource) → Future< void> - Subscriber attribute associated with the install media source for the user
-
setMixpanelDistinctID(
String mixpanelDistinctID) → Future< void> - Subscriber attribute associated with the Mixpanel Distinct Id for the user Required for the RevenueCat MixPanel integration
-
setMparticleID(
String mparticleID) → Future< void> - Subscriber attribute associated with the mParticle Id for the user Recommended for the RevenueCat mParticle integration
-
setOnesignalID(
String onesignalID) → Future< void> - Subscriber attribute associated with the OneSignal Player Id for the user Required for the RevenueCat OneSignal integration
-
setPhoneNumber(
String phoneNumber) → Future< void> - Subscriber attribute associated with the phone number for the user
-
setProxyURL(
String url) → Future< void> - Set this property to your proxy URL before configuring Purchases only if you've received a proxy key value from your RevenueCat contact.
-
setPushToken(
String pushToken) → Future< void> - Subscriber attribute associated with the push token for the user
-
setSimulatesAskToBuyInSandbox(
bool enabled) → Future< void> - iOS only. Set this property to true only when testing the ask-to-buy / SCA purchases flow. More information: http://errors.rev.cat/ask-to-buy
-
setup(
String apiKey, {String? appUserId, bool observerMode = false, String? userDefaultsSuiteName, bool useAmazon = false, bool usesStoreKit2IfAvailable = false}) → Future< void> - Sets up Purchases with your API key and an app user id.
-
syncObserverModeAmazonPurchase(
String productID, String receiptID, String amazonUserID, String? isoCurrencyCode, double? price) → Future< void> - This method will send a purchase to the RevenueCat backend. This function should only be called if you are in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
-
syncPurchases(
) → Future< void> - This method will send all the purchases to the RevenueCat backend.