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 now we need to implement our first payment solution and that's going to be PayPal. So first we need to set up an app in the PayPal developer site and create two sandbox accounts, one for personal and one for business. The business is to receive money and the personal is to buy and test. And we're working with the sandbox so of course there's no real money or real banks involved at all. Then we're going to set up a file with our functions that interact with the PayPal API, and there's going to be three functions here. One is going to be to generate an access token, one to create an order, and I mean a PayPal order, not an order in our database, but on the PayPal side, and then one to capture payment. And this is where I want to do a little bit of unit testing, and we have no other way to run and test these functions, so I figured that writing a couple tests would be a nice thing to throw in the course. All right, once we know they work, we'll start to create the server action to…

Contents