Save the Order

Learn how to save the order after the payment is completed.


In this lesson, we’ll learn how to save the order after checkout. Remember, we have a list of cartItems. Stripe response gave us a sessionId, which need to be stored.

We also need to store productId, price and quantity. You might wonder what is the need to store price, if we’ve stored productId. It can be fetched from the product table if needed. Storing price is helpful when it is updated in the product table, and we need to show users the price when they placed the order.

Get hands-on with 1200+ tech skills courses.