Skip to main content

Hi RevenueCat team,

I'm experiencing an issue with the relative_discount calculation in my paywall.

Setup
- Package 1: 6 months subscription at €59.99
- Package 2: 12 months subscription at €55.00 (with 8% OFF badge)

Expected behavior
The annual package should show ~54% discount compared to 6-month package:
- 6 months annualized: €59.99 × 2 = €119.98/year
- 12 months: €55.00/year
- Real discount: (119.98 - 55) / 119.98 = 54.17%

Actual behavior
PaywallView displays "8% OFF" which is incorrect.

Questions
1. How is relative_discount calculated exactly?
2. Is this comparing against a different reference price?
3. Should I configure something specific in my offering setup?

Environment
- purchases_ui_flutter: ^8.10.1
- Platform: Android/iOS

Any guidance would be appreciated!

 

 

Hey,

Thank you for reaching out and providing so much detail. We're happy to help!

As you mentioned, your calculation for the expected behavior is the correct one. Showing 8% OFF is not accurate.

I ran your configuration locally and see the relative_discount to be calculated correctly, showing 27% as the pricing offered has changed. Could you please confirm you're also seeing the correct discount and prices configured on your end for both Android and iOS?

For reference, this is what I'm seeing locally:

?name=image.png

Below you can find my answers to your questions:

How is relative_discount calculated exactly?

relative_discount returns the localized discount percentage of a given package compared to the most expensive package per period that's offered on your paywall. That is precisely how you calculated it in your example. Here, there's another example: if you're displaying a monthly package that is $10/month, and a yearly package that is $80/year (or $6.67/month), the relative discount for the annual package is 67%, meaning that the paywall will show a 33% discount off.
 

Is this comparing against a different reference price?

No, it only compares the price to the most expensive package per period on your current paywall.
 

Should I configure something specific in my offering setup?

Not really. Just make sure your paywall includes more than one package. Use relative_discount only on the cheaper packages; the most expensive one will return “null” because it has no discount to compare to.

I hope this helps. Please let me know if you have any questions.

Best, 


Reply