Purchases class

Constructors

Purchases()

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

apiKey String
getter/setter pair
isAnonymous Future<bool>
If the appUserID has been generated by RevenueCat
no setter
purchaserInfo ValueListenable<PurchaserInfo>
no setter
supportsSDK bool
final
userId String?
getter/setter pair

Static Methods

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).
collectDeviceIdentifiers() Future<void>
Automatically collect subscriber attributes associated with the device identifiers $idfa, $idfv, $ip on iOS $gpsAdId, $androidId, $ip on Android
createAlias(String newAppUserID) Future<PurchaserInfo>
This function will alias two appUserIDs together.
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.
getPaymentDiscount(Product product, Discount discount) Future<PaymentDiscount>
iOS only. Use this function to retrieve the PurchasesPaymentDiscount for a given PurchasesPackage.
getProducts(List<String> productIdentifiers, {PurchaseType type = rc.PurchaseType.subs}) Future<List<Product>>
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.
getPurchaserInfo() Future<PurchaserInfo>
Gets current purchaser info, which will normally be cached.
invalidatePurchaserInfoCache() Future<void>
Invalidates the cache for purchaser information.
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, PaymentDiscount discount) Future<PurchaserInfo>
iOS only. Purchase a package applying a given discount.
purchaseDiscountedProduct(Product product, PaymentDiscount discount) Future<PurchaserInfo>
iOS only. Purchase a product applying a given discount.
purchasePackage(Package packageToPurchase, {UpgradeInfo? upgradeInfo}) Future<PurchaserInfo>
Makes a purchase. Returns a PurchaserInfo object. Throws a PlatformException if the purchase is unsuccessful. Check if PurchasesErrorHelper.getErrorCode(e) is PurchasesErrorCode.purchaseCancelledError to check if the user cancelled the purchase.
purchaseProduct(String productIdentifier, {UpgradeInfo? upgradeInfo, PurchaseType type = rc.PurchaseType.subs}) Future<PurchaserInfo>
Makes a purchase. Returns a PurchaserInfo object. Throws a PlatformException if the purchase is unsuccessful. Check if PurchasesErrorHelper.getErrorCode(e) is PurchasesErrorCode.purchaseCancelledError to check if the user cancelled the purchase.
restoreTransactions() Future<PurchaserInfo>
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
setAllowSharingStoreAccount(bool allowSharing) Future<void>
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
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.
setKeyword(String keyword) Future<void>
Subscriber attribute associated with the install keyword for the user
setMediaSource(String mediaSource) Future<void>
Subscriber attribute associated with the install media source for the user
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
syncPurchases() Future<void>
This method will send all the purchases to the RevenueCat backend.