#mrjoozy - react client and server

1 messages · Page 1 of 1 (latest)

austere crag
#

hey there, this is a fairly common set up when running react applications with a server/backend component

#

that server typically runs listening on another port and needs to be proxied for front end access

next root
#

ive done this so far but when i click on checkout, it says

austere crag
#

is your server running?

next root
#

i think so?

austere crag
#

ok and what do you get if you access that on port 5000 instead of 3000?

#

since that's where you have it listening

next root
#

its cannot GET instead of cannot POST now

austere crag
#

that endpoint is defined for POST, not GET

#

can you take off the create-checkout-session and try just localhost:3000/

#

That should get you the static front end, the session create post endpoint in for the backend call made by the client

next root
next root
austere crag
#

ok looks like progress!

#

that seems like teh right front end, then the client code makes the post request to get the checkout session

next root
#

yup when i click the button this is the code that handles the checkout button

#

this is the result of clicking the button

austere crag
#

And then you changed the port in the server.js file?

next root
#

yup

austere crag
#

OK did you also change the port in the proxy line in package.json?

next root
#

just did that

#

ah wait ok mybad i used https instead of http for localhost. it works now

#

thanks m8 much appreciated

austere crag
#

NP!

next root
# austere crag NP!

actually i have one more question, after a successful stripe payment, is there a way to keep a customers email and send them a e receipt of some sorts? also can it be a custom email where i send them instructions on how to use the product they have bought

austere crag
#

You dashboard settings allow you to set up automatic receipt emails if preferred, otherwise you can inspect the customer email after the checkout session completes (eg, using webhooks) and create/send your own custom receipt.

next root
austere crag