npm i --save @mleleux/nativescript-revenuecat
- Version: 1.0.2
- GitHub: https://github.com/mleleux-heykiddo/nativescript-plugins
- NPM: https://www.npmjs.com/package/%40mleleux%2Fnativescript-revenuecat
- Downloads:
- Last Day: 0
- Last Week: 3
- Last Month: 128
@mleleux/nativescript-revenuecat
RevenueCat SDK for NativeScript
A powerful and reliable in-app purchase server that makes it easy to build, analyze, and grow your subscriber base whether you're just starting out or already have millions of customers.
npm install @mleleux/nativescript-revenuecat
Usage
Initialize the SDK with your api key before the app boots:
Application.on(Application.launchEvent, () => {
RevenueCat.configure('<api-key>');
});
OR
Initialize the SDK with your api key and unique userId before purchasing or restoring previous purchases is required:
RevenueCat.configure('<api-key>', '<userId>');
Testing
-
Make sure to update the
nativescript.config.ts -> id
value so that it matches your setup in RevenueCat before testing this plugin. -
If you are using the
getProducts
method to test, be sure to update the product id's withintools -> demo -> nativescript-revenuecat -> index.ts
API
RevenueCat.configure(apiKey: string, appUserId?: string)
: Initialize the SDK with your api key and optional appUserIdRevenueCat.setSimulatesAskToBuyInSandbox- (simulatesAskToBuyInSandbox: boolean)
: Set this property totrue
to enable simulating the Ask-To-BuyRevenueCat.getProducts(productIdentifiers: string[], type?: ProductCategory)
: Fetch the products for the given identifiersRevenueCat.getCurrentOffering()
: Fetch the current offeringRevenueCat.getAllOfferings()
: Fetch all offeringsRevenueCat.getEntitlementInfos()
: Fetch the entitlements for the userRevenueCat.purchaseProduct(product: Product)
: Purchase a productRevenueCat.restorePurchases()
: Restore purchasesRevenueCat.getAppUserID()
: Get the current app user idRevenueCat.logIn(appUserID: string)
: Log in with the given app user idRevenueCat.logOut()
: Log out the current userRevenueCat.setDebugLogsEnabled(enabled: boolean)
: Enable debug logsRevenueCat.setLogLevel(level: number)
: Set the log levelRevenueCat.getCustomerInfo()
: Fetch the customer infoRevenueCat.setAttributes(attributes: { [key: string]: - string })
: Set the attributes for the userRevenueCat.setEmail(email: string)
: Set the email for the userRevenueCat.setPhoneNumber(phoneNumber: string)
: Set the phone number for the userRevenueCat.setDisplayName(displayName: string)
: Set the display name for the userRevenueCat.setFirebaseAppInstanceID(firebaseAppInstanceID: - string)
: Set the firebase app instance idRevenueCat.setKeyword(keyword: string)
: Set the keywordRevenueCat.canMakePayments()
: Check if the user can make paymentsRevenueCat.isConfigured()
: Check if the SDK is configured