Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

93
Views
¿Cómo evitar que la función dentro de otra función actualice los detalles de mi formulario?

Tengo una función que se supone que debe enviar los detalles de la tarjeta a Stripe. El stripe.confirmCardPayment está dentro handleSubmit y durante la depuración me di cuenta de que los detalles de mi formulario se borran cada vez que se llama a una función de espera ( tokenize() o confirmCardPayment() ). ¿Cómo puedo evitar eso?

editar: creé myTest() y lo llamé con await dentro de handleSubmit y no está actualizando el formulario en absoluto. ¡Estoy completamente perdido!

 function myTest(){ return 'hey' }

La función handleSubmit :

 //Submit payment to Stripe and handle error const handleSubmit = async(e) => { e.preventDefault(); console.log('CheckoutHandleSubmit'); //verify instance and token is there if(!stripe || !elements || !token || !data){ console.log('return !') return } //Get CardElement and attach to DOM const cardElement = elements.getElement(CardElement); cardElement.mount('#card-element'); debugger //console.log('creating payment intent'); //console.log('myData:', data); //console.log('beforeTokenizing:'); //Tokenize card details and handle errors try{ const unTest = await myTest(); // => returns 'hey', do not refresh form const payload = await stripe.confirmCardPayment( data.info.clientSecret, { payment_method: { card: cardElement, //billing_details: { name: formData.lastnameInput }, }, } ) //console.log('payload:', payload) }catch(err){ console.log('err:', err) } const tokenize = await swell.payment.tokenize({ card: { onError: (err) => { //inform the customer there was an error if(err){ console.log('error:', err); } //setProcessing(false); }, onSuccess: async() => { //submit the form } } }) };
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!