S
S
semki0962019-05-20 08:55:44
Online shopping
semki096, 2019-05-20 08:55:44

How to build order logic in the store?

I watch the ordering process in some stores. For example, the order page /checkout- why is this page not linked to an order number, for example, not /checkout/88. Or is the order number stored in the session?
It is also not clear how to generate order data before sending it to the payment service. For example, I take the data from the cart before sending. But I also need to empty this basket. So, for example, if the user decides to refresh the page before sending the data, then there will be no data because the basket has already been cleared.
I would be grateful for an explanation of the logic of the sequence of actions for the implementation of the order.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nrgian, 2019-05-20
@nrgian

For example, the /checkout order page - why is this page not linked to an order number, for example, not /checkout/88. Or is the order number stored in the session?

There are GET requests,
there are POST requests
, and yes, there are sessions.
It makes /checkout/88no sense - since this is a one-time operation and there is no need to be able to get there by link at any time (which GET provides)
It is also not clear how to generate order data before sending it to the payment service. For example, I take the data from the cart before sending. But I also need to empty this basket. So, for example, if the user decides to refresh the page before sending the data, then there will be no data because the basket has already been cleared.
The fact that the user has gone to the payment service does not mean that he has paid.
It could have had a payment failure (for example, there is no money on this card) and you need to send it to the payment service again.
Or he decided to pay by another method and you need to send him to the payment service in a different way.
Or he decided to add more goods.
And at that time you have already cleared the basket and thereby lost the client with a high probability
. Payment services often notify about the payment for the order.
That's when the basket needs to be emptied.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question