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.

Payment method and Zod schemas

Payment method and Zod schemas

All right. So now we want to start on this payment method page. And basically, we want to have a form, much like we have for the shipping address, right? We'll show this at the top, the steps. And then we'll have the page. And then we'll have the form, which will submit to an action. So I want to start off with the action, as well as a couple constants that I want to add in the schema. So let's start off with the constants, which I'm also going to have environment variables for. And that's going to be the payment methods and the default payment method. So in your .env, we're going to add payment underscore method, or methods, sorry. And then this is going to be a comma separated list. So we're going to say PayPal, and then comma space. And that's important that you put the space, because we're actually going to be bringing this into our constants file and creating an array from it using split. So PayPal, and then let's say Stripe. And we're also going to have cash on, not that kind of…

Contents