Change the current app user id. Returns the customer info for the new user id.
The user id to change to.
Retrieves a specific offering by a placement identifier. For more info see https://www.revenuecat.com/docs/tools/targeting
The placement identifier to retrieve the offering for.
Optional
params: GetOfferingsParamsThe parameters object to customise the offerings fetch. Check GetOfferingsParams
Gets latest available CustomerInfo.
The latest CustomerInfo.
PurchasesError if there is an error while fetching the customer info.
Fetch the configured offerings for this user. You can configure these in the RevenueCat dashboard.
Optional
params: GetOfferingsParamsThe parameters object to customise the offerings fetch. Check GetOfferingsParams
Convenience method to check whether a user is entitled to a specific entitlement. This will use Purchases.getCustomerInfo under the hood.
The entitlement identifier you want to check.
Whether the user is entitled to the specified entitlement
Loads and caches some optional data in the Purchases SDK. Currently only fetching branding information. You can call this method after configuring the SDK to speed up the first call to Purchases.purchase.
Method to perform a purchase for a given package. You can obtain the package from Purchases.getOfferings. This method will present the purchase form on your site, using the given HTML element as the mount point, if provided, or as a modal if not.
The parameters object to customise the purchase flow. Check PurchaseParams
a Promise for the customer info after the purchase is completed successfully.
PurchasesError if there is an error while performing the purchase. If the PurchasesError.errorCode is ErrorCode.UserCancelledError, the user cancelled the purchase.
Method to perform a purchase for a given package. You can obtain the package from Purchases.getOfferings. This method will present the purchase form on your site, using the given HTML element as the mount point, if provided, or as a modal if not.
The package you want to purchase. Obtained from Purchases.getOfferings.
Optional
customerEmail: stringThe email of the user. If undefined, RevenueCat will ask the customer for their email.
Optional
htmlTarget: HTMLElementThe HTML element where the billing view should be added. If undefined, a new div will be created at the root of the page and appended to the body.
a Promise for the customer info after the purchase is completed successfully.
PurchasesError if there is an error while performing the purchase. If the PurchasesError.errorCode is ErrorCode.UserCancelledError, the user cancelled the purchase.
Static
configureConfigures the Purchases SDK. This should be called as soon as your app has a unique user id for your user. You should only call this once, and keep the returned instance around for use throughout your application.
RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
Your unique id for identifying the user.
Advanced http configuration to customise the SDK usage HttpConfig.
PurchasesError if the API key or user id are invalid.
Static
getGet the singleton instance of Purchases. It's preferred to use the instance obtained from the Purchases.configure method when possible.
UninitializedPurchasesError if the instance has not been initialized yet.
Static
isStatic
setSet the log level. Logs of the given level and below will be printed
in the console.
Default is LogLevel.Silent
so no logs will be printed in the console.
LogLevel to set.
Entry point for Purchases SDK. It should be instantiated as soon as your app is started. Only one instance of Purchases should be instantiated at a time!