From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Stripe payment success page

Stripe payment success page

Okay, so I want to now create a success page for Stripe Payments, and what I've done is I've just gone through, added some products, and I created a new order. I clicked Place Order, and I chose Stripe, so now I'm on the page to pay, and I haven't paid yet. So before we pay, let's go ahead and create our success page, which is going to go in app, root, order, brackets ID, and then a folder we're going to create called Stripe, Let's say stripe-payment-success, and in that, we'll have a new file called page.tsx. And we'll call this success page. And for now, we'll just output success. All right, now a couple things that we're going to want to do here. We're going to bring in stripe from stripe. And then we're going to initialize right here a new stripe object. So let's say stripe and set that to new stripe. And then that gets passed in our secret key. So we need to pass in process dot env dot and then stripe underscore secret key, and as string. OK, so now we have that. Now, this…

Contents