Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

210
Visualizações
Integrating Stripe with React Native

We are trying to integrate Stripe into a react native app using @stripe/stripe-react-native. We followed this tutorial https://www.youtube.com/watch?v=DZlAET7Tgx4 https://www.youtube.com/watch?v=DZlAET7Tgx4 for reference.

Our API call is returning an undefined object. We think it might have to do with the API url but we've tried everything (localhost, ip address of computer, ip address of wifi) and nothing is working. We try to console log within the post method but nothing prints which makes us think it's not being called properly. We have a server running using express. Any help would be greatly greatly appreciated :)

This is our post method:

app.post('/create-payment-intent', async (req, res) => {
  console.log("test place 1")
  try {
    const paymentIntent = await stripe.paymentIntents.create(
      {
        amount: 1099,
        currency: "usd",
        payment_method_types: ["card"],

      }
    );
    const clientSecret = paymentIntent.client_secret;
    res.send({
      clientSecret: clientSecret,
    });
  } catch (e) {
    res.json({ error: e.message });
  }
})

And this is when we call it:

const API_URL = "http://10.49.40.160:8000"

const StripeApp = props => {
  const [email, setEmail] = useState();
  const [cardDetails, setCardDetails] = useState();
  const { confirmPayment, loading } = useConfirmPayment();
  const fetchPaymentIntentClientSecret = async () => {
    const response = await fetch(`${API_URL}/
    create-payment-intent`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        paymentMethodType: 'card',
        currency: 'usd',
      }),
    });
    const { clientSecret, error } = await response.json();
    return { clientSecret, error };
  }

Thank you so much!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Can you verify the API found at the URL you provide is active and will return the expected response? It sounds like you already know that is an issue.

If you are just getting started and not necessarily looking to build something immediately production ready, I have found it useful to have a relatively simple back-end that does the bare minimum you will need to test out development ideas.

Stripe provides the code and and even a deployment tool for a simple mobile back-end. If you follow the deployment instructions it will deploy a basic server to Heroku for free. Just be sure to take note of the url and save that information in your app configuration.

Even if you are not too familiar with Ruby syntax (the server is written in Ruby, web.rb) the functions are minimal enough you can look at the code snippets in Stripe Docs to get an idea of what that code is doing.

Happy coding! 😄

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda