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.

Section intro

Section intro

So, in this section, we're going to add Stripe payments to our application, and it's nice to give your users a few different options to pay with. So we first need to set up our Stripe account to use test mode, which is as simple as just flipping a switch in the dashboard. We also need to get our API keys and add them to both the .env file in development and the Vercel platform environment variables in production. Then we're going to create something called the payment intent. This is a core concept in Stripe's API that represents a specific transaction for collecting payment from a customer, and the Stripe API gives us the methods that we need for this, so we'll be installing a few NPM packages to work with Stripe. Then we need to create the PaymentInform component. This will show things like the credit card and expiration inputs on the Order Details page. Stripe also gives us a fake credit card to work with to test things out. Alright, then we need to create a payment success page…

Contents