6 ms·
> [...] how a typical store with a shopping cart works; do everything on the server side, and just display it to the client. The same concerns apply for a typi
by jrgv 3y ago
> [...] how a typical store with a shopping cart works; do everything on the server side, and just display it to the client.
The same concerns apply for a typical shopping cart design. The price can change in between the time when you sent the price to the client, and the time when the user actually decides to buy.
- dmacedo 3y agoMajority of times I've seen this being solved with shopping cart items being copied from the main product table by SKU with the current price. There is a TTL on the shopping cart itself. However, that meant for a period of time you had a frozen cost per-line-item in a shopping cart.
- jchw 3y agoWell, in case of the server-side shopping cart, the server would have enough state to know if the price has changed since an item was added to the shopping cart, so the client wouldn't necessarily need to participate in preventing this scenario. I'm sure in practice, the checkout confirmation process for modern e-commerce sites also takes extra precautions to ensure that it can only happen exactly once and that it fails if any details change during the process of checking out.