April 2020
Intermediate to advanced
716 pages
18h 55m
English
The final element in the checkout view is the Place Order button, which will complete the checkout process if all the details are entered correctly. We will add this button to the PlaceOrder component after CardElement, as shown in the following code.
mern-marketplace/client/cart/PlaceOrder.js:
<Button color="secondary" variant="raised" onClick={placeOrder}>Place Order</Button>
Clicking on the Place Order button will call the placeOrder method, which will attempt to tokenize the card details using stripe.createToken. If this is unsuccessful, the user will be informed of the error, but if this is successful, then the checkout details and generated card token will be sent to our server's create order API (covered ...
Read now
Unlock full access