#AlexFitFlow

1 messages ยท Page 1 of 1 (latest)

mild muralBOT
echo fox
#

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

smoky thorn
#

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>
echo fox
#

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?

smoky thorn
#

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

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?

smoky thorn
#

How can I check that? It was running my Stripe keys just fine locally

#

As for now im not sure

#

How can I check?

echo fox
#

You would need to log the Stripe keys on your server

smoky thorn
#

A console log? Where would I place that?

echo fox
#

You are making requests from the browser to a server you control to generate the Checkout session, correct?

smoky thorn
#

I believe so. That would be my back end server.js

#

Im using Node and Express