Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.
/ KMPRevenueCat Public archive

Unofficial RevenueCat wrapper library for Kotlin Multiplatform. It provides a unified API for managing subscription and in-app purchases across both iOS and Android platforms.

License

Notifications You must be signed in to change notification settings

mirzemehdi/KMPRevenueCat

Repository files navigation

KMPRevenueCat - Kotlin Multiplatform RevenueCat Library

Build Kotlin Maven Central

badge-android badge-ios

⚠️ Repository Archived

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

Installation

Minimum Requirements

  • Android: minSdkVersion 24

  • iOS: minDeploymentTarget 15.0

  • RevenueCat Android version: 7.11.0

  • RevenueCat iOS version: 4.43.0

Gradle Setup

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: Maven Central.

sourceSets {
  commonMain.dependencies {
    implementation("io.github.mirzemehdi:kmprevenuecat-purchases:<version>") //RevenueCat Purchases
    implementation("io.github.mirzemehdi:kmprevenuecat-purchases-ui:<version>") //RevenueCat Purchases UI
  }
}

Available Functions

Purchases

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)

Purchases-UI

//This Composable can be used in Compose Multiplatform

@Composable
fun Paywall(shouldDisplayDismissButton: Boolean = true,onDismiss: () -> Unit,listener: PaywallListener?)

About

Unofficial RevenueCat wrapper library for Kotlin Multiplatform. It provides a unified API for managing subscription and in-app purchases across both iOS and Android platforms.

Topics

Resources

License

Stars

Watchers

Forks