I’m using the RevenueCat KMP SDK and have a weekly subscription that includes an introductory offer.
I want to display both the regular price and the introductory offer price in my UI.
How can I retrieve both prices using the SDK?
I’m using the RevenueCat KMP SDK and have a weekly subscription that includes an introductory offer.
I want to display both the regular price and the introductory offer price in my UI.
How can I retrieve both prices using the SDK?
Best answer by guilherme
Hey
You can get both the regular and introductory prices from the StoreProduct in the KMP SDK. Something like this should do:
val offerings = Purchases.sharedInstance.getOfferings()
val package = offerings.current?.weekly ?: return
val product = package.storeProduct
val regularPrice = product.price.formatted // the product price
val introPrice = product.introductoryDiscount?.price?.formatted // the intro discount
println("Regular: $regularPrice")
if (introPrice != null) {
println("Intro: $introPrice, then $regularPrice/week")
}
For more detail on StoreProduct and its fields, see: https://revenuecat.github.io/purchases-kmp/models/com.revenuecat.purchases.kmp.models/-store-product/index.html#-596915275%2FProperties%2F1207467509
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.