#jay492

1 messages · Page 1 of 1 (latest)

thin moonBOT
hard aurora
#

Can you provide more details? How are you integrating with Stripe: Checkout, PaymentElement?

upper pine
#

using checkout.sessions

hard aurora
#

Is this blocking the redirect or is this just a warning you see in the browser's console?

upper pine
#

i can open the payment filling page so it's just in the browser

#

what i'm trying to do is

#

and in that page, if you click the checkout, i want customers to go to the checkout page but checkout page is taking me to mywebsitedomain/DOMAIN/create-checkout-session

hard aurora
#

I don't really follow. Do you have a test environment that I can look at?

upper pine
#

how can i show that?

hard aurora
#

Is all your testing local for now or do you have a domain that uses your test mode keys to create Checkout sessions?

upper pine
#

testing local worked so trying to use my website to do the same thing

hard aurora
#

Do you have a request ID from the Checkout Session creation?

upper pine
#

i checked the logs but it was all okay

#

in the checkout.html. I do like belew so

#

In the server.js, do i have to change the app.post('/create-checkout-session', async (req, res) => { to the following?

hard aurora
#

Is this still part of your local testing? If so, you should just have a path on your server code to /create-checkout-session, and the button client side that calls that endpoint

thin moonBOT
upper pine
#

No, i 'm testing on the server. It's not local. I already tried what you have sent t o me and it worked.

upper pine
covert quest
#

Hello! I'm taking over and catching up...

#

So on your server if you change app.post('/create-checkout-session' to app.get('/create-checkout-session' and then link to /create-checkout-session from your payment.html page does it work as expected?

#

The idea is that you 1) send your customer to /create-checkout-session on your server which 2) creates a Checkout Session and 3) redirects the customer to the Checkout Session's url and then 4) now they're on a Checkout page.

upper pine
#

oh hi Rubeus!!

#

When i press the checkout in the checkout.html, it took to this link mywebsitedomainexample/create-checkout-session?lookup_key=jj16 which is a bit of progress from before but still can't see the checkout page

covert quest
#

What happens now?

upper pine
#

sorry i hid a couple of parts but it's just my website domain

covert quest
#

Are you testing locally? Are you hitting your domain on port 3002?

upper pine
#

ah no

covert quest
#

Wait, you didn't change app.post to app.get.

#

Change it to app.get('/create-checkout-session' and then try to manually visit that URL in your browser.

upper pine
#

do i still changing post to get in checkout.html right?

#

if i'm running on server, not locally, do i need the port and app.listen() in the server.js?

upper pine
covert quest
#

That depends on how your environment is set up.

#

You may or may not need the port number. For example, if you're using a reverse proxy, you probably don't.

#

But if you're hitting the Node server directly then you would need it.

#

And to clarify, what I'm asking you to do is visit yourdomain.whatever:portmaybe/create-checkout-session in your browser manually.

#

Did that work or do you still get an error?

upper pine
#

I'm still getting an error

covert quest
#

What if you add the port?

upper pine
#

where do you add port3002?

covert quest
#

Like that.

upper pine
#

i got This site can’t be reached

covert quest
#

Let's back up a bit.

upper pine
covert quest
#

Your payment.html page loads, right?

upper pine
#

yes

#

i can see in on the browser

covert quest
#

Okay, so is that page being served by your Node code, or something else?

covert quest
#

Can you show me the current version of your server code?

upper pine
#

one difference is i have my proper domain in the actual file

covert quest
#

Okay, and after you changed it to app.get you restarted the Node server?

upper pine
#

not yet

covert quest
#

Oh. Restart the server and try again.

#

The changes you make to your server-side code won't take effect until you restart the Node process.

#

Otherwise the existing Node process with the old code is still running.

upper pine
#

i tried it but still gets an error

covert quest
#

Same error or different?

upper pine
#

same error

covert quest
upper pine
upper pine
covert quest
#

No, sorry.

#

Do not use your payment.html.

#

If you type/paste that in, but with the correct domain, what happens?

upper pine
#

it's hard to see but it says strict-origin-when-cross-origiin

#

on the right side in the error section

covert quest
#

That's not related.

#

I don't understand how your Node code could be throwing a Not Found error for that URL.

#

Just to be crystal clear, this is you typing it in in a new tab without your payment.html page involved at all, right?

upper pine
#

do i have to push the server.js to website server as well?

covert quest
#

Push? I don't know, can you explain more about how your infrastructure is set up?

upper pine
#

sorry not push.Upload to a server. Coz currently my server.js is just in my vscode

upper pine
covert quest
#

So the URL you're trying to load there... that's on a server? It's not a local domain running on your own computer?

#

If that's the case then yeah, you need to upload your changes to the server and restart the Node process on the server for those changes to take effect.

#

If there's a different server running your Node code it will only know about changes to your Node code that you upload to it.

covert quest
upper pine
#

it still says not found

covert quest
#

So if you make changes to payment.html, like changes you can see when you load that page, do those changes show up?

upper pine
#

let me try

#

it got changed

#

checkout→checkoutttttt

covert quest
#

Okay, so in your server code, this is the line that makes that page work: app.use(express.static("public")); //allows to use static files which are in the public folder, make a static page in the public folder

upper pine
#

yes

covert quest
#

If you comment that line out and then upload/whatever you have to do and then restart the Node server, does that payment.html page still load?

#

Trying to confirm you can make changes to your server code that impact what happens.

upper pine
covert quest
#

Yes.

#

Just to test and see if your changes are actually having any impact.

#

If you comment that out and you can still load the payment.html page then you know your server isn't picking up your changes.

upper pine
#

i commented out these lines but still could see the page

covert quest
#

Yeah, okay, so your changes aren't being picked up.

#

You need to figure out why.

#

How did you originally get the code onto the server?

upper pine
#

so when i finish making changes, i upload the file to a sever that i pay for it

covert quest
#

Then what?

upper pine
#

and then automatically the changes get updated

covert quest
#

That only works for your static files, like payment.html.

#

For your server code you need to restart the Node process on your server.

#

Typically that's done via SSH.

#

How did you originally start the Node process on your server?

upper pine
#

npm init -y

covert quest
#

What you did locally doesn't matter.

#

The Node process is running on your server.

upper pine
#

npm run dev

covert quest
#

How did you get it running?

#

On your server, not locally?

upper pine
#

that's locally

covert quest
#

Right. Don't care about that. What you did locally doesn't matter.

#

What did you do to get the Node process running on your server?

thin moonBOT
upper pine
#

i didn't do anything. I uploaded (checkout, success, cancel, and client.js) and it automatically done it for you

covert quest
#

Automatically done by what?

#

A control panel?

upper pine
#

yes

covert quest
#

Go into the control panel and stop the Node process, then start it again.

upper pine
#

oh wait if i didn't install node.js for the control panel(server) i have to do that first?

#

for php, i only have to upload so thougt that i only need it on my computer but for node.js, you need to have it on a server as well?

crisp basin
#

👋 Taking over this thread

upper pine
#

hi

crisp basin
#

The control panel is the admin page that your hosting provider provides

#

After you make changes on your node server, you'd need to upload the changes again and restart the server to pick up the new changes

upper pine
#

i made a server locally on my computer but that is not enough?

upper pine
crisp basin
#

Yup! you should install node.js to the server if you wish to have the server run on the domain

#

I'd recommend getting the Node developer to help with the development and deployment process, or you may use PHP for development if that works better for you

upper pine
#

so this works because doing locally but if i want to do it on a server(website) and customers to do the payment, i need to install node developer..?

#

or is using php easier?

crisp basin
#

If you're more familiar with PHP, I'd recommend using PHP. Otherwise, hiring a Node developer with the integration and code deployment will be more suitable for your case as we do not know how your hosting provider works

upper pine
#

so this code will never work on the server because i don't have node.js installed on the server( but locally)?

crisp basin
#

Since the integration works locally on localhost but not on the server, the issue is likely with your node setup at the hosting provider end. We don't know how your hosting provider works, so can't advice further

upper pine
#

if i want to do it with php, i can just replace with following code for scheckout session?

crisp basin
upper pine
#

it's a subscription

crisp basin
upper pine
#

do i even need to put the checkout, success, cacel and client.js into the public folder on server? or i can just keep them out.