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.

Implement PayPal button

Implement PayPal button

All right, so now that we have our actions, we need to create our front-end PayPal buttons. And you could integrate the SDK and script tags or whatever, but that can get kind of messy. So we're using this third-party package called React PayPal JS. And as you can see here, it's a solution to abstract away complexities around loading the JavaScript SDK. And it enforces best practices by default by having the buyers get the best possible user experience. So we want to install this, and then we can just bring in the PayPal buttons. And that has to be wrapped in the PayPal script provider component. That's what actually provides the SDK. And there's also a hook we're going to bring in to manage the loading state. So let's go ahead and install that. We're going to come down here to the terminal and npm install. And it's at PayPal slash React dash PayPal dash JS. And let's see, did I get in there? Yeah, so I just have to add, since React 19 is so new, I just have to do the legacy dash peer…

Contents