Skip to content

Tiered Pricing API Reference

This page documents the API for the business KPIs module in Pypulate.

Tiered Pricing Module

This module provides functions for calculating tiered pricing structures.

calculate_tiered_price(usage_units, tiers, cumulative=True)

Calculate price based on tiered pricing structure.

Parameters:

Name Type Description Default
usage_units float

The number of units consumed

required
tiers dict

Dictionary of tier ranges and their prices Format: {"0-1000": 0.10, "1001-2000": 0.08, "2001+": 0.05}

required
cumulative bool

If True, price is calculated cumulatively across tiers If False, entire usage is priced at the tier it falls into

True

Returns:

Type Description
float

Total price based on tiered pricing