Integrate create-checkout-session API
Learn how to integrate the front-end with the back-end API and redirect it to the Stripe-hosted checkout page
We'll cover the following
We’ll call the cart
API. After getting all the items in the cart, we’ll call the /create-checkout-session
API and store the sessionId
in the local storage. We’ll redirect the user to the Stripe-hosted payment page. This page will redirect us to the success or fail page.
Get all the cart items
We’ll define the getAllCartItems
function, which will convert cartItems
to checkoutBodyArray
. We’ll use it to call /create-checkout-session
. This function will be called in the mounted
method.
Get hands-on with 1400+ tech skills courses.