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.

Generate access token

Generate access token

OK, so we're going to start to work with the PayPal API to set this up. And there's a few things we need to do. First, we need to be able to generate an access token. And an access token is a secure identifier that will allow our app to interact with PayPal services on behalf of a user or a merchant. And it grants the necessary permissions to do things like create orders, process payments, issue refunds, things of that nature. All right, so we'll do that. Then we need to create a couple functions to create an order and to capture payment. And then we can integrate those into our application. And we're going to use a package called ReactJS PayPal that will give us PayPal buttons. And we'll have the window open up where we enter our credentials and so on. So let's start off with just being able to generate an access token. This is the docs for it. So basically, we need to make a request to this endpoint. So our sandbox PayPal and then slash V1 OAuth2 slash token. And we need to send…

Contents