#jay492
1 messages · Page 1 of 1 (latest)
Can you provide more details? How are you integrating with Stripe: Checkout, PaymentElement?
Is this blocking the redirect or is this just a warning you see in the browser's console?
i can open the payment filling page so it's just in the browser
what i'm trying to do is
i have a website page so http://mydomainexample/payment.html
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
I don't really follow. Do you have a test environment that I can look at?
how can i show that?
Is all your testing local for now or do you have a domain that uses your test mode keys to create Checkout sessions?
testing local worked so trying to use my website to do the same thing
our current website is using http but is that why when i click payment in https://mywebsitedomain/payment.html , it takes you to https://mywebsitedomain/DOMAIN/create-checkout-session and returns The requested URL was not found on this server?
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?
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
I recommend following this guide: https://stripe.com/docs/checkout/quickstart?lang=node
No, i 'm testing on the server. It's not local. I already tried what you have sent t o me and it worked.
In this example, if my website domain is stripeexample.com. , where would you change to make checkout working?
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.
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
What happens now?
Are you testing locally? Are you hitting your domain on port 3002?
ah no
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.
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?
so I'm hitting like https://mydomainexample/public/payment.html (payment is my checkout.html)
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?
I'm still getting an error
i tried https://mywebsitedomain/create-checkout-session but still got the The requested URL was not found on this server. error message404
What if you add the port?
where do you add port3002?
i got This site can’t be reached
Let's back up a bit.
sakura.ne.jp refused to connect.
Your payment.html page loads, right?
Okay, so is that page being served by your Node code, or something else?
yep by node.js
Can you show me the current version of your server code?
Okay, and after you changed it to app.get you restarted the Node server?
not yet
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.
i tried it but still gets an error
Same error or different?
same error
And this is without the port number, right? https://mywebsitedomain/create-checkout-session
yep, did it without port number
No, sorry.
If you manually put https://mywebsitedomain/create-checkout-session in your browser does it work?
Do not use your payment.html.
If you type/paste that in, but with the correct domain, what happens?
it's hard to see but it says strict-origin-when-cross-origiin
on the right side in the error section
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?
do i have to push the server.js to website server as well?
Push? I don't know, can you explain more about how your infrastructure is set up?
sorry not push.Upload to a server. Coz currently my server.js is just in my vscode
i tried safari but it was the same
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.
yes. https://mywebsitedomain/sakura.ne.jp is the server
Okay, so if you uplaod the new code and restart the Node server, then go to the https://mywebsitedomain/create-checkout-session page what happens?
it still says not found
So if you make changes to payment.html, like changes you can see when you load that page, do those changes show up?
same as this
let me try
it got changed
checkout→checkoutttttt
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
yes
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.
so just comment this line out?
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.
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?
so when i finish making changes, i upload the file to a sever that i pay for it
Then what?
and then automatically the changes get updated
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?
npm run dev
that's locally
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?
i didn't do anything. I uploaded (checkout, success, cancel, and client.js) and it automatically done it for you
yes
Go into the control panel and stop the Node process, then start it again.
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?
👋 Taking over this thread
hi
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
i made a server locally on my computer but that is not enough?
you saying i need to install node.js to the server that i pay for to do this not locally?
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
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?
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
so this code will never work on the server because i don't have node.js installed on the server( but locally)?
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
if i want to do it with php, i can just replace with following code for scheckout session?
got it from here https://stripe.com/docs/billing/quickstart?lang=php
For one-time payment, this should be the guide to follow: https://stripe.com/docs/checkout/quickstart?lang=php&client=html
it's a subscription
Ah I see, then yes! https://stripe.com/docs/billing/quickstart?lang=php is correct for subscription
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.