getSavingsPercent

open fun getSavingsPercent(baseProductId: String, comparedProductId: String): Int

Whole-percent saving of comparedProductId against baseProductId, normalized to a common monthly cadence.

The canonical use is the "Save 40%" badge on an annual plan: pass the monthly product as the base and the yearly product as the comparison. Both products' base offers are used, so trial and introductory phases do not distort the result.

Return

Whole-percent saving in 0..100; 0 when either plan is unavailable or the compared plan is not cheaper per month.

Since

4.4.0

Parameters

baseProductId

The plan being compared against, usually monthly.

comparedProductId

The plan the badge is for, usually yearly.