#Apollo_4
1 messages · Page 1 of 1 (latest)
Hi there! Can you share more details? I'm not quite sure I follow what you're doing exactly.
So basically everything works locally but when running live the checkout buttons throw 404 errors. I know this has something to do with the fact that im running my main website (with checkout html page) on bluehost, and the node js server with stripes components on AWS EC2. I know the server is running and Ive tried re routing traffic and making everything public but no matter what I get 404 errors when trying to click the checkout buttons that go to the checkout.stripe.com page. I will also note im using prebuilt checkout API although at this point I dont think that matters. This may be outside of your field but I have tried so many things and these checkout buttons just always throw 404 errors live. Im sorry this is so long but I had to explain so there is context, I hope you understand.
What exactly is returning the 404 error? what request are you making when you get this response?
Just the checkout buttons that take you to stripes payment page. it occurs on myDomain/create-checkout-session (when post request is fired)
Got it. Do you receive an error message alongside the 404 error code?
No its just a plain 404 not found
what is create-checkout-session attempting to do? Could you share some of your Node code (omitting any secret keys and personal information)?
The post request given by stripe, this is the code: app.get('/create-checkout-session', async (req, res) => {
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items: [
{price: 'price_1NGm3MBFnGmcJ0YATWzyd71J',quantity: 1},
],
custom_fields: [{
key: 'size',
label: { type: 'custom', custom: 'Shirt Size'},
type: 'dropdown',
dropdown: {
options: [
{label: 'Small', value: 'S'},
{label: 'Medium', value: 'M'},
{label: 'Large', value: 'L'},
{label: 'XL', value: 'XL'},
]
}
}],
success_url: ${YOUR_DOMAIN}/success.html,
cancel_url: ${YOUR_DOMAIN}/cancel.html,
automatic_tax: {enabled: true},
});
res.redirect(303, session.url);
});
"The requested url was not found on this sever"
Okay, I see your requests to create a Checkout Session are succeeding. Are you being redirected to a Stripe-hosted Checkout Session? That should be what's happening here: res.redirect(303, session.url);
Indeed thats what should be happening, but it does not happen live. If I run everything locally it will do so perfectly. This is why I think it has something to do with the fact that main html pages, and server code, is hosted on seperate platforms/
If thats the case and you don't have any answers for that, that is okay, but at this point im just looking for any advice or leads to get these checkout buttons to work live
The requests we're seeing are still using localhost for the success_url and cancel_urls, too
I assume that's not what you're expecting?
that snippet was from my local code since its easier to access but on my live server file my domain is reflected
Those are likely the successful runs I was able to make running it locally
I ran it locally with live API key to and it still worked
but yes running it live it should be myDomain/for success and cancel, but in my live code I have made sure to use my domin ]
domain*
Gotcha, understood. However, the logs I'm seeing for requests made with your live key also use localhost
When was the most recent request?
The latest live mode request was made within the last minute
If you look here: https://dashboard.stripe.com/logs
The logs I see on my end for the latest request to create a Checkout Session is for a request ending in Nua5
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
All request IDs begin with req_... so you should be able to pull that up quickly
Okay then we may be onto something here...the last time I tried the button via my website was probably 20 minutes ago, however, in that code, my domains are lightsnack.net instead of localhost
The request ending in Nua5 definitely used localhost instead of your live domain
Is it possible you're mixing up your API keys?
I am using secret
Oh, hold on a second, I'm wrong
The last request we received in live mode for this account was on June 26
okay, now I think we're getting somewhere
Okay then that is not the issue
I pulled up the account I'm looking at based on the price ID you shared. Is it possible you're using secret keys from one account but a price ID from a totally different account?
No I just have the one account
Are you able to log the value of session.url?
Maybe let me see
This is what it is https://lightsnack.net/create-checkout-session but it throws a 404 error on the post request
That doesn't really help. I think we're back to this being a routing issue if your code never actually gets to execute the code in create-checkout-session
Yeah it just cant do that post request live, only locally. I think having the server elsewhereis causing some weird issue
If theres any advice you could give or potential work arounds, im all for it
im running my main website (with checkout html page) on bluehost, and the node js server with stripes components on AWS EC2
why isn't this all hosted in the same place?
Bluehost threw a wrench into that. The person im creating the online shop for purchased bluehost for $100 and it runs the normal web pages perfectly. I tried to run the server on bluehost as well, but they make you pay even more for node / server features ( a lot more) to the point where the only option is hosting the server elsewhere
Hi 👋
I'm stepping in. Is there anything else you h aev a question about?
No im just looking for any advice or alternatives
any advice or alternatives
About what?
So basically everything works locally but when running live the checkout buttons throw 404 errors. I know this has something to do with the fact that im running my main website (with checkout html page) on bluehost, and the node js server with stripes components on AWS EC2. I know the server is running and Ive tried re routing traffic and making everything public but no matter what I get 404 errors when trying to click the checkout buttons that go to the checkout.stripe.com page. I will also note im using prebuilt checkout API although at this point I dont think that matters. This may be outside of your field but I have tried so many things and these checkout buttons just always throw 404 errors live. Im sorry this is so long but I had to explain so there is context, I hope you understand.