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

285
Visualizações
usar el método de pago para la intención de pago de la franja

Tengo esto:

 const stripe = require('stripe')('sk_test', { stripeAccount: 'acct_...' }); const paymentIntent = await stripe.paymentIntents.create({ amount: 1900, currency: 'cad', customer: 'cus_...', // confirm: true, }, { stripeAccount: 'acct_...', }); console.log(paymentIntent)

entonces voy a ejecutar este pago Intento, y funciona, pero en realidad no cobra al cliente porque dice que no tiene ningún método de pago registrado. Entonces, tomo la identificación de este cliente y miro mi panel de control, y muestra el método de pago allí, y el método coincide con la identificación. así que ahora creo que estoy haciendo algo mal al crear el paymentIntent , pero el pago se está realizando, simplemente no está confirmado porque dice que no hay ningún método de pago adjunto. Entonces, ¿por qué esto no funciona?

error: UnhandledPromiseRejectionWarning: Error: You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

PaymentIntent requiere un objeto de método de pago como;

 payment_method_types: [card],

Objeto PaymentIntent

 const { error: backendError, clientSecret, paymentIntentId, transfer_group, } = await fetch('/create-payment-intent', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ paymentMethodType: 'card', currency: 'cad', customerEmail: billingDetails.email, description: 'Basket_Order_Id', }), }).then((r) => r.json()); and when you created the paymentintent on your backend you should return app.post('/create-payment-intent', async (req, res) => { const {paymentMethodType, currency, customerEmail, description, suppliers} = req.body; console.log('paymentIntent Create requ body', req.body); req.session.suppliers = suppliers; suppliersArray = suppliers; const idEmpotency = nanoid(); // Each payment method type has support for different currencies. In order to // support many payment method types and several currencies, this server // endpoint accepts both the payment method type and the currency as // parameters // // Some example payment method types include `card`, `ideal`, and `alipay`. const params = { payment_method_types: [paymentMethodType], 'CARD' amount: 20000, currency: currency, description: description, receipt_email: customerEmail, statement_descriptor_suffix: 'Your Bank Descriptor on Customer Account', transfer_group: idEmpotency, // confirm: true, // capture_method: 'manual', }; try { const paymentIntent = await stripe.paymentIntents.create(params); // Send publishable key and PaymentIntent details to client console.log('paymentIntent', paymentIntent); res.send({ clientSecret: paymentIntent.client_secret, - SENDING YOUR CLIENTSECRET paymentIntentId: paymentIntent.id, transfer_group: paymentIntent.transfer_group, }); } catch (e) { return res.status(400).send({ error: { message: e.message, }, }); } }); client_secret and use it on your front-end const {error: stripeError, paymentIntent} = await stripe.confirmCardPayment( clientSecret, USE YOUR CLIENT SECRET THAT RETURNED FROM YOUR BACKEND FROM PAYMENT INTENT OBJECT { payment_method: { card: elements.getElement(CardElement), billing_details: { name: 'Michael', }, }, } ); Before confirming the client_secret that returned from payment_intent you can not succesfully confirm the payment. You can use stripe elements to start with their own card payment component. I recommend you to check here https://stripe.com/docs/payments/quickstart, you will get more idea...
about 4 years ago · Juan Pablo Isaza 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