Answer the question
In order to leave comments, you need to log in
How to calculate the cost?
A question. The site issues an invoice to the user when buying goods.
On the one hand, it seems logical to have a JS part that shows the final cost, on the other hand, this is a potential security hole.
How right? After selecting goods, their cost is calculated on the server each time? And return the result? Or does it need to be duplicated somehow?
Answer the question
In order to leave comments, you need to log in
If the formulas are simple and do not require a bunch of requests to third-party services, you can calculate at the front so that the user can immediately see the price.
If this is already an order being placed (with the calculation of delivery and other things), then let everything be considered on the backend.
And also, when paying, the amount should be formed only by the backend.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question