Skip to main content

Pricing policies

Summary

A pricing policy is a set of rules applicable to different entities such as resources or event-types that allow the automatic calculation of a reservation's price. Pricing policies are designed to offer flexibility and cover various use cases.

A pricing policy is made of 2 attributes. The effective period and the price.

Effective period

The first thing we need to establish in a pricing policy is the period of time during which it is applicable using its effectivePeriod property. Read more about this on the schedule object docs.

{
effectivePeriod: null,
}

Price

Next, we have the price. Generally, the price can be defined using a function that will be called at the time of booking with all the required parameters. This allows creating any imaginable pricing policy. Offering volume discounts, changing the price based on the number of reservations a person has made, modifying the price based on the advance of booking, etc.

The price is an attribute with the identifier of the pricing function. This function can be customized or one of the predefined functions provided by TimeTime can be used.

Predefined prices

Fixed

A fixed pricing policy charges a set amount for each reservation, regardless of the duration or other factors. This is straightforward and suitable for services where the cost is consistent.

For example, a fixed price of 30€ per reservation:

{
effectivePeriod: null,
pricePolicy: {
id: 'FIXED',
amount: "30.00",
currency: "EUR"
}
}
Time based

A time-based pricing policy charges a set amount per unit of time, such as per hour. This is useful for services where the cost is dependent on the length of time the resource is used.

Fixed price of 30€ per hour:

{
effectivePeriod: null,
pricePolicy: {
id: 'TIME_BASED',
duration: 'PT1H',
amount: "30.00",
currency: "EUR",
}
}
Tiered

A tiered pricing policy charges different rates based on predefined time intervals. This approach is suitable for services where the cost varies with the duration, encouraging longer usage periods with different rates.

{
effectivePeriod: null,
pricePolicy: {
id: 'TIERED',
tiers: [
{
duration: 'PT1H'
args: { amount: "30.00", currency: "EUR"}
},
{
duration: 'PT1H30M'
args: { amount: "40.00", currency: "EUR"}
},
{
duration: 'PT2H'
args: { amount: "45.00", currency: "EUR"}
},
]
}
}