#Apollo_4

1 messages · Page 1 of 1 (latest)

sharp pawnBOT
grave talon
#

Hi there! Can you share more details? I'm not quite sure I follow what you're doing exactly.

sharp pecan
#

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.

grave talon
#

What exactly is returning the 404 error? what request are you making when you get this response?

sharp pecan
#

Just the checkout buttons that take you to stripes payment page. it occurs on myDomain/create-checkout-session (when post request is fired)

grave talon
#

Got it. Do you receive an error message alongside the 404 error code?

sharp pecan
#

No its just a plain 404 not found

grave talon
#

what is create-checkout-session attempting to do? Could you share some of your Node code (omitting any secret keys and personal information)?

sharp pecan
#

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"

grave talon
#

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);

sharp pecan
#

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

grave talon
#

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?

sharp pecan
#

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*

grave talon
sharp pecan
#

When was the most recent request?

grave talon
#

The latest live mode request was made within the last minute

#

All request IDs begin with req_... so you should be able to pull that up quickly

sharp pecan
#

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

grave talon
#

The request ending in Nua5 definitely used localhost instead of your live domain

#

Is it possible you're mixing up your API keys?

sharp pecan
#

I am using secret

grave talon
#

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

sharp pecan
#

Okay then that is not the issue

grave talon
#

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?

sharp pecan
#

No I just have the one account

grave talon
#

Are you able to log the value of session.url?

sharp pecan
#

Maybe let me see

grave talon
#

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

sharp pecan
#

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

grave talon
#

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?

sharp pecan
#

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

sharp pawnBOT
tidal elm
#

Hi 👋

I'm stepping in. Is there anything else you h aev a question about?

sharp pecan
#

No im just looking for any advice or alternatives

tidal elm
#

any advice or alternatives
About what?

sharp pecan
#

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.