This repository is archived and no longer maintained.
This project is officially supported by RevenueCat. Please refer to the official repository for the latest updates, issues, and contributions.
- No new issues or pull requests will be accepted here.
- For any questions or contributions, please use the official repository.
KMPRevenueCat is an unofficial Kotlin Multiplatform library designed as a wrapper for RevenueCat. It provides a unified API for managing subscription and in-app purchases across both iOS and Android platforms. You can see how this library is used in FindTravelNow production Compose + KMP project. For the documentation, please refer to the official RevenueCat Documentation, Kotlin section. The library is designed in the same way as it is shown in the official documentation.
Related Blog Post (if you want to integrate it yourself without this library): https://medium.com/@mirzemehdi/integrating-revenuecat-into-kotlin-multiplatform-465ffa47a97b
-
Android:
minSdkVersion 24
-
iOS:
minDeploymentTarget 15.0
-
RevenueCat Android version:
7.11.0
-
RevenueCat iOS version:
4.43.0
KMPRevenueCat is available on Maven Central. In your root project build.gradle.kts
file (or settings.gradle
file) add mavenCentral()
to repositories.
You will also need to include RevenueCat library to your ios app from XCode using Swift Package Manager or Cocoapods.
repositories {
mavenCentral()
}
Then in your shared module add desired dependencies in commonMain
. Latest version: .
sourceSets {
commonMain.dependencies {
implementation("io.github.mirzemehdi:kmprevenuecat-purchases:<version>") //RevenueCat Purchases
implementation("io.github.mirzemehdi:kmprevenuecat-purchases-ui:<version>") //RevenueCat Purchases UI
}
}
var logLevel: LogLevel
fun configure(apiKey: String, appUserId: String? = null)
fun login(appUserId: String, onResult: (Result<LogInResult>) -> Unit)
fun logOut(onResult: (Result<CustomerInfo>) -> Unit)
fun getCustomerInfo(fetchPolicy: CacheFetchPolicy = CacheFetchPolicy.default(),onResult: (Result<CustomerInfo>) -> Unit)
fun setAttributes(attributes: Map<String,String?>)
fun setFirebaseAppInstanceID(firebaseAppInstanceID: String)
fun collectDeviceIdentifiers()
fun enableAdServicesAttributionTokenCollection()
fun syncPurchases(onResult: (Result<CustomerInfo>) -> Unit)
//This Composable can be used in Compose Multiplatform
@Composable
fun Paywall(shouldDisplayDismissButton: Boolean = true,onDismiss: () -> Unit,listener: PaywallListener?)