Next.js Discord

Discord Forum

Problems when Integrating PAYPAL

Answered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
Hello! Ive been trying whole 3 days to integrate paypal to my website but it keeps showing this error(s) inside the console of the website. Hope someone can help me out solve this frustrating problem. Hope someone can help me as this is urgent, very.

To be honest I dont really understand what´s going wrong, sorry if I dont give more information.
Here I will leave the codes followed with the image for easier location of the files (in case that`s the problem).
Answered by Clown
That location is wrong. It should be /app/api/checkout
View full answer

42 Replies

Masai LionOP
Give me second to send codes, thanks.
@Masai Lion Give me second to send codes, thanks.
Sun bear
If you have issues with sharing the code (if it's too big for Discord) you can use this website (it deletes your code after a period which you can set) then you can just share the link here. The website automatically colours your code. Just thought it may help.

https://paste.ec/
Masai LionOP
Thank you! I will sure do, thanks!
Sun bear
I don't think so. You can create 2 links like you can open that link in two tabs and paste 1 file in one tab and submit and then the other in the other tab and so on (that's how I usually do it) 😄
Sun bear
Yup just delete sensitive keys/info beforehand.
@Masai Lion Oh I delete the keys before sending
It’s not only about that. I’ll need your code first
@Anay-208 It’s not only about that. I’ll need your code first
Masai LionOP
Sure! I am just preparing the link
Done
I messed up in the first comment
I’ll see it in few hours
Masai LionOP
Sure! Thank you
Masai LionOP
Hello. I still need help :))
Masai LionOP
Don’t forget me please :((
The second error is most likely due the first error. You are probably doing response.json() without checking if the response code is 200(response.ok())
Since the POST api route is returning 404, its basically returning a 404 html page and you cant convert that to JSON
@Masai Lion Click to see attachment
That location is wrong. It should be /app/api/checkout
Answer
@Clown That POST request is returning 404. maybe you havent exported the POST function?
Masai LionOP
As far as I remember I am exporting it
@Clown That location is wrong. It should be /app/api/checkout
Masai LionOP
So then I move the file, and that should fix it all?
Masai LionOP
Dayum
Why I never thought of that
And what if it doesn’t?
the location you pass to fetch is relative to app folder
@Masai Lion And what if it doesn’t?
You write here again with the error
Masai LionOP
Interesting
@Clown You write here again with the error
Masai LionOP
Alr
So then I will make the change and hopefully it works
And also check if POST is exported
:sunglasses_1:
Masai LionOP
But I am 60% certain it is
Thanks monkey
You deserve banana
@Clown <:sunglasses_1:767749456648339497>
Masai LionOP
Monke
It worked
Thank you