E-commerce
Dynamic pricing without losing trust
Dynamic pricing is legal, but a discount must point at the lowest price of the previous 30 days and a personalised price must be declared before purchase.
Key points
- Formatting a million prices with a fresh Intl.NumberFormat per value costs 52.444 µs per price; with one reused formatter, 0.995 µs.
- Applying a price rule and rounding to the cent costs 0.0086 µs, 31 times less than toFixed(2) on the same loop.
- Article 17-bis of the Consumer Code, added by Legislative Decree 26/2023, requires the lowest price of the previous 30 days in every reduction announcement.
- Article 49(1)(e-bis) of the Consumer Code requires disclosing a price personalised by automated decision-making.
Dynamic pricing is legal in Italy, but trust breaks the moment a customer finds the price changed and cannot see why. The working rule: change a price only on conditions you can state, and when you advertise a discount, point at the lowest price of the previous 30 days.
A price is data, not an opinion
A pricing engine takes three inputs: cost, availability and demand. If one of the three is not written down anywhere, the price comes from a hunch and you cannot explain it tomorrow. Before you change a price, try to say in one sentence why it changed. If the sentence does not exist, the rule does not exist.
The constraint no pricing engine knows about
Article 17-bis of the Italian Consumer Code, added by Legislative Decree 26 of 7 March 2023 and in force since 2 April 2023, says every price-reduction announcement must show the price the trader applied in the 30 days before the reduction, not a price picked at will. Article 49(1)(e-bis) of the same code, which transposes Article 6 of Directive 2011/83/EU as amended by Directive (EU) 2019/2161, requires telling the consumer when the price was personalised through automated decision-making. The GDPR (Regulation (EU) 2016/679, Articles 13 and 22) adds the duty to state your legal basis and to give an explanation when the decision is automated only.
What a price calculation costs
The calculation is not the problem: 0.0086 µs per price means one core can evaluate a hundred million rules a second. Formatting is where the money goes. If a listing shows 60 products and every price builds a new formatter, the browser pays 3.15 ms for the numbers alone; on a price list of 10,000 entries the same choice costs 524 ms against 9.95 ms with one reused formatter. The second cost is the query: a rule that reads three tables per product in a listing is slower than the arithmetic by four orders of magnitude.
node -e "const f=new Intl.NumberFormat('it-IT',{style:'currency',currency:'EUR'});let t=performance.now();for(let i=0;i<1e5;i++)new Intl.NumberFormat('it-IT',{style:'currency',currency:'EUR'}).format(i+0.9);console.log('nuovo',(performance.now()-t).toFixed(1),'ms');t=performance.now();for(let i=0;i<1e5;i++)f.format(i+0.9);console.log('riusato',(performance.now()-t).toFixed(1),'ms')"
Three rules that keep trust
Where trust actually breaks
The three mistakes that end up in a complaint to the Italian competition authority are not clever algorithms: countdowns that restart on refresh, "only 3 left" that stays at three for a week, and discounts computed on a list price nobody ever paid. These are misleading practices under Articles 20-23 of the Consumer Code, and the cost is not only the fine: it is the customer who never comes back. A higher price for a returning buyer can be defended only if the rule is declared and the customer can check it.
The limit of this measurement
We measured the cost of calculation and formatting, not perception. A 2% move is invisible, a 15% move on the second visit is remembered, and no benchmark tells you where the line falls for your audience. The only valid test is a controlled experiment with two groups, measuring repurchase at 90 days rather than same-day conversion, because dynamic pricing often moves a sale instead of creating one.
Where to start
Frequently asked questions
Is dynamic pricing legal in Italy?
Yes, when the price depends on conditions you can state and the customer is informed. It becomes unlawful when it hides a condition, fakes scarcity, or computes a discount from a price nobody ever paid: those are misleading practices under Articles 20-23 of the Consumer Code.
Do I have to declare a personalised price?
Yes. Article 49(1)(e-bis) of the Consumer Code requires telling the consumer when the price was personalised through automated data processing. The notice must arrive before the consumer is bound by the contract.
Must a discount refer to the 30-day price?
Yes. Article 17-bis of the Consumer Code, in force since 2 April 2023, requires every reduction announcement to show the lowest price applied to consumers in the previous 30 days. A list price from months ago is not a valid previous price.
How expensive is a price computed on the fly?
Cheap: 0.0086 µs per rule and rounding. Formatting is the cost, 0.995 µs with a reused formatter and 52.444 µs when you build one per price. On a 10,000-row list the difference is 9.95 ms against 524 ms.
Can I change a price after showing it?
You can change it for later visits, not for a placed order: the price shown at checkout binds the contract. If the price was plainly wrong, cancel the order and refund, explaining the error, rather than charging the difference.