View Source Plausible.Billing.Plans (Plausible v0.0.1)

Summary

Functions

Returns a list of growth plans available for the user to choose.

Returns the most appropriate plan for a user based on their usage during a given cycle.

This function takes a list of plans as an argument, gathers all product IDs in a single list, and makes an API call to Paddle. After a successful response, fills in the monthly_cost and yearly_cost fields for each given plan and returns the new list of plans with completed information.

List yearly plans product IDs.

Functions

Link to this function

available_plans_for(user, opts \\ [])

View Source
Link to this function

business_plans_for(user)

View Source
Link to this function

business_tier?(subscription)

View Source
Link to this function

get_price_for(enterprise_plan)

View Source
Link to this function

get_regular_plan(subscription, opts \\ [])

View Source
Link to this function

get_subscription_plan(subscription)

View Source
@spec growth_plans_for(Plausible.Auth.User.t()) :: [Plausible.Billing.Plan.t()]

Returns a list of growth plans available for the user to choose.

As new versions of plans are introduced, users who were on old plans can still choose from old plans.

Link to this function

latest_enterprise_plan_with_price(user)

View Source
Link to this function

subscription_interval(subscription)

View Source
Link to this function

suggest(user, usage_during_cycle)

View Source
@spec suggest(Plausible.Auth.User.t(), non_neg_integer()) ::
  Plausible.Billing.Plan.t()

Returns the most appropriate plan for a user based on their usage during a given cycle.

If the usage during the cycle exceeds the enterprise-level threshold, or if the user already belongs to an enterprise plan, it suggests the :enterprise plan.

Otherwise, it recommends the plan where the cycle usage falls just under the plan's limit from the available options for the user.

This function takes a list of plans as an argument, gathers all product IDs in a single list, and makes an API call to Paddle. After a successful response, fills in the monthly_cost and yearly_cost fields for each given plan and returns the new list of plans with completed information.

@spec yearly_product_ids() :: [String.t()]

List yearly plans product IDs.