Answer the question
In order to leave comments, you need to log in
When to empty the user's cart in your online store engine?
In a self-written engine for an online store, I can’t figure out when it’s better to empty the user’s basket.
The user clicked pay. Let's say that the payment system is such that confirmation can take at least a few minutes.
Or maybe an hour or two.
Thus, the user paid on a third-party site, he was transferred back to my store. "Thank you, the payment was, but not yet confirmed"
Before the payment is confirmed or not confirmed, what to do with the user's shopping cart if he continues to surf the site?
*That is, in terms of user experience and UX.*
Clear immediately? What if the payment is not confirmed? And he may want to pay again using another bank card.
Or spit on this case - is unknown.
Do not clean immediately, but wait 5 minutes - several hours? Then he will be able to roam the site with a basket in which he has goods that he has already bought - inconvenient, illogical.
Answer the question
In order to leave comments, you need to log in
First: payment and confirmation
It is
necessary to work adequately with payment confirmation
when you transfer the order data, then you encode the data with one key
, the bank decodes and then encodes with the second key, and when you confirm them, you will also decode them with the second key and see which order the bank confirmed
All payments that I know work according to this principle:
- 2 keys are issued
- send data there - encode with one
- decode the received data with the second
- there is an order number in the received data
Empty the basket immediately after accepting the order and write the order into orders ( which is logical)
Whether the order is paid or not is another story, in case of a payment error, the user will simply have an unpaid order
. If you need to remind something, remind. You, they say, have not paid for the order, pay while the goods are in place
You must have a separate entity - an order, of which there are many, which have a status - not paid, paid, delivered, etc. at the moment when you click pay - the entire contents of the basket should move to a new order and the basket should be cleared.
If necessary, give the user the opportunity to open the order history and, if necessary, fill the basket again (or re-pay if the status is refused/error/cancelled).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question