DEV Community

How to integrate Paypal with NextJs

Husnain Mustafa on July 03, 2023

Payment integration is the most required thing when we are heading to develop a an eCommerce website. And Paypal is one of the most common platform...
Collapse
 
matheusdamiao profile image
Matheus Damião

That was absolutely great, Husnain!
With your explanation I could easily set up PayPal to work in a Next13 project.
Thanks for your post!

Collapse
 
tajalde49174992 profile image
TAJALDEEN

this is super useful but I find it hard to connect my redux with it

Collapse
 
husnain profile image
Husnain Mustafa

I know its really late, but do you still need help?

Collapse
 
mrstevedev profile image
Steve Pulido

This is not working for me. The buttons do not render on the page.

I was using ** react-paypal-button-v2 ** for quite a long time but out of nowhere it has suddenly stopped working, something about 403 Forbidden on capture.

I tried to implement this and it also is not working but just not rendering the button on the page.

Collapse
 
yameen_blogs_4d46639a0eb1 profile image
Gerald ONE

Thanks, this was really helpful.

The sandbox tokens worked great on localhost. But when I deployed to Preview on Vercel, I was getting "PayPal error: – Error: Failed to get PayPal access token: 401 Unauthorized" errors. Any ideas?

Collapse
 
eaclegend profile image
EAClegend

I have a question regarding the backend/paypal client import, I am unsure what I should put there or what I should be doing for that

Collapse
 
husnain profile image
Husnain Mustafa

Do you still need help?

Collapse
 
mitch1009 profile image
Mitch Chimwemwe Chanza • Edited

its coming from this file:

/utils/paypal/index.js:
Enter fullscreen mode Exit fullscreen mode

remember it was exported as client, he made a mistake on the import

Collapse
 
ibnu_rasikh profile image
Ibnu Rasikh

not work, mine doesn't even render. your instruction unclear, so many miss writing/typo, makes me confused a lot. doesn't even tell me this is for the app router or pages router, what next js version do you use, even doesn't tell this is for typescript or javascript, i get so many red lines, if you think it will make the article too long of less effective, please at least give us the full code in your repo, so we can manually check the details in your package.json or anything.

Collapse
 
samuelnihoul profile image
Samuel Nihoul

The "order" and "wallet" objects that you return in your respective API responses are not declared. What did you mean to do?

Collapse
 
jhayboy profile image
justice

hello, please is there a video example of this