#scmitton

1 messages · Page 1 of 1 (latest)

grizzled gullBOT
fathom thunder
#

Here is where I'm trying to confirm the setup
const confirmSetup = async () => {
stripe.confirmSetup({
clientSecret,
confirmParams: {
payment_method_data: {
card: elements.getElement(CardElement),
billing_details: {
name: document.getElementById('name-on-card').value,
email: JSON.parse(sessionStorage.getItem("user")).email,
address: {
city: document.getElementById('city').value.split(',')[0],
state: document.getElementById('city').value.split(',')[1],
postal_code: document.getElementById('zip').value
}
}
},
return_url: ${window.location.origin}/success
}
}).then((result) => {
if (result.error) {
setErrMsg(result.error.message)
} else {
if (result.paymentIntent.status === 'succeeded') {
setSucceeded(true)
}
}
})
}

somber island
fathom thunder
#

req_e86sp9LTphBbEr

somber island
#
You cannot confirm this SetupIntent because it's missing a payment method. Update the SetupIntent with a payment method and then confirm it again.
#
  const {error} = await stripe.confirmSetup({
    //`Elements` instance that was used to create the Payment Element
    elements,
    confirmParams: {
      return_url: 'https://example.com/account/payments/setup-complete',
    }
  });
#

When using confirmSetup you should pass the elements directly here

fathom thunder
#

What about the client secret?

somber island
#

Just the client secret then how do you pass in the payment info of the customer?

#

Hmm you used card: elements.getElement(CardElement)

#

Is there a Doc you are following?

fathom thunder
#

In that scenario I was using what copilot suggested

somber island
#

I don't believe that's correct. Please follow the Doc here. The step is "Submit the payment to Stripe"

fathom thunder
#

Thank you

#

Does confirmSetup not work with cardElement?

somber island
#

No. CardElement has the confirmCardSetup method instead