Skip to main content
Solved

Migrating to 6.0 - freeTrialPeriod and subscriptionPeriod not found

  • September 25, 2023
  • 1 reply
  • 48 views

Forum|alt.badge.img+2

Hello,

 

I’m struggling with the RevenueCat update from 5.x to 6.4.0 on Android.

 

I have currently a method to load the weekly subscription, however product doesn’t have subscriptionPeriod any longer.
 

fun loadWeeklyProduct(onPackageLoaded: (Package?) -> Unit) {
    Purchases.sharedInstance.getOfferingsWith(
        { error ->
            // An error occurred
        }) { offerings ->
        val annualProduct = offerings.current?.availablePackages?.firstOrNull { item ->
            item.product.subscriptionPeriod == "P1W"
        }
        onPackageLoaded(annualProduct)
    }
}

And with this other method I would check if they still are eligible for Trial. Sadly product also no longer has any freeTrialPeriod.

 

private fun fillTrialOrNormal(it: Package) {
    val hasFreeTrial = !it.product.freeTrialPeriod.isNullOrEmpty()
    Utilities().checkTrialUsedUp(it.product.sku, hasFreeTrial) { trialUsedUp ->
        var title = ""
        var header = ""
        if (trialUsedUp) {
            title = "${it.product.price} / Year"
            header = getString(R.string.upgrade_to_premium)
            binding.premiumTextId.text = header
        } else {
            title = "Start Your 3 Days Free Trial,\nThen ${it.product.price} / Year"
        }
        binding.trialPurchaseButtonId.text = title
        binding.trialPurchaseButtonId.isEnabled = true
    }
}

 

I couldn’t find anything about this on the migration document.  I would really appreciate any hints how to achieve this.  

 

Many Thanks,

Houman

Best answer by Ryan Glanz

Hi Houman,

Here’s our StoreProduct doc, which has a period property, which is now the subscriptionPeriod.

The StoreProduct also has a subscriptionOptions property, which has some relevant properties for trials, etc.

View original
Did this post help you find an answer to your question?

1 reply

Ryan Glanz
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 383 replies
  • Answer
  • September 27, 2023

Hi Houman,

Here’s our StoreProduct doc, which has a period property, which is now the subscriptionPeriod.

The StoreProduct also has a subscriptionOptions property, which has some relevant properties for trials, etc.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings