#AlexFitFlow
1 messages ยท Page 1 of 1 (latest)
Hi ๐
What isn't working?
The most likely cause is that your API keys are not being propagated but you should first implement some logging around your initialization of Stripe
This is how my server.js back end used to be working when it functioned locally.
This is how it is now deployed with me changing the endpoints
This was the first checkout.js front end checkout button that worked className='btn btn-dark btn-lg btn-block'
onClick={async () => {
const products = state;
let response = await axios({
method: "post",
url: "http://localhost:3001/checkout",
data: {
products,
shipping,
},
}).catch((error) => error.response);
// Should see the response we sent back from the server in the browser console
console.log("RESPONSE FROM SERVER: ", response);
if (response.data.url) {
// save local storage state
let decoded = decodeURI(response.data.url);
window.location.assign(decoded);
console.log("DECODED", decoded);
}
}}>
Confirm Checkout
</button>
This is how I changed it for deployment. <button
className='btn btn-dark btn-lg btn-block'
onClick={async () => {
const products = state;
let response = await axios({
method: "post",
url: "/checkout",
data: {
products,
shipping,
},
}).catch((error) => error.response);
// Should see the response we sent back from the server in the browser console
console.log("RESPONSE FROM SERVER: ", response);
if (response.data.url) {
// save local storage state
let decoded = decodeURI(response.data.url);
window.location.assign(decoded);
console.log("DECODED", decoded);
}
}}>
Confirm Checkout
</button>
I'n not reading all this
Can you simply describe what isn't working?
Can you initialize Stripe?
Can you create a Payment Intent or Checkout Session?
This is the console log error message
Im trying to figure out what isnt working
"Can you initialize Stripe?
Can you create a Payment Intent or Checkout Session?" I could do all that locally but now its now working deployed
I used checkout session
well yes I click the confirm checkout button and nothing happens. It worked perfectly on my local host. Im asking how I should change my front and back end code now that it is deployed for it work properly
@real halo @wheat wagon
@marsh tundra @rare marsh
@echo fox
There are A LOT of reasons this could break from your local machine to a deployment. First can you verify that your runtime environment is loading your Stripe API keys?
How can I check that? It was running my Stripe keys just fine locally
As for now im not sure
How can I check?
You would need to log the Stripe keys on your server
A console log? Where would I place that?
You are making requests from the browser to a server you control to generate the Checkout session, correct?