Web service is not loading on mobile device

i deployed a backend server on render and it only redirects to stripe checkout on a desktop not a mobile after doing some research i can see i am fetching from localhost4000 which is for my backend however this is on local host what do i enter to fetch it from render.com i have entered my server URL but its still not working

const checkout = async (e) => {
    e.preventDefault();
    await fetch("http://localhost:4000/checkout", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ items: cart.items }),
    })
      .then((response) => {
        return response.json();
      })
      .then((response) => {
        if (response.url) {
          window.location.assign(response.url); // Forwarding user to Stripe
        }
      });
  };```

Hi there,

You’d need to ensure you’re not referencing localhost when you’ve deployed your code to any service on the internet, Render or another provider. It probably works on your desktop if that is also running what you expect on localhost.

I’m not able to comment on what you should enter, as that’s very much an application configuration

Regards,

John B
Render Support, UTC+1 :uk:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.