From the course: Master Next.js by Building Scalable Apps with Routing, Databases, and Performance

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Testing the checkout API using Postman

Testing the checkout API using Postman

In the previous lecture, we have created an API for updating databases after successfully purchasing the products. Now let's test the API using postman. So I will open the postman application and will copy the URL and open a new tab. Then let me paste the URL and change the route to slash checkout. And let me set the request method to POST. Now the checkout API has to receive the payment and checkout data which is given by the payment gateway. So let's first get the actual data to test this API. I will go to the client directory and open the page component of the payment status. Here I will create a new object which will contain the data from the response object of the checkout session. So I will say const updateResponseObject is equal to. Then I will take address from the session, shipping details, then the city, and likewise the customer ID, email, SO date time, grand total, and payment mode. And finally, the products where I will assign the json.parse session.metadata.products…

Contents