#nicolasbouteilleelephorm_93575

1 messages · Page 1 of 1 (latest)

median tinselBOT
vagrant jasper
#

Since we are not using the PaymentElement form, I figured I needed to skip the 'elements' parameter and only provide 'clientSecret' and 'confirmParams' with return_url and payment_method.
However, I received the following error :
Uncaught (in promise) IntegrationError: Invalid value for stripe.confirmPayment(): value should be an object. You specified: pi_XXXX_secret_XXXXX.
It seems the JS does not understand that I am skipping the 'elements' parameter and providing 'clientSecret' as first parameter because it expects an object but clientSecret is a string.

I also tried to pass null for the first parameter before clientSecret, but this time I received:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'handleActions')

So I don't know how to skip 'elements' parameter. Which makes me wonder if I am supposed to do what I am trying to do… I'm a bit lost…

What am I missing?
Thank you

mint harbor
#

I'll be with your momentarily! Can you share some code in the meantime?

vagrant jasper
#

thank you

#
stripe.confirmPayment(
                null, // elements
                settings.clientSecret,
                { // confirmParams
                  return_url: settings.returnUrl,
                  payment_method: settings.paymentMethod
                }
              ).then(function (result) {
                if (result.error) {
mint harbor
#

So you have a pre-existing pm_xxx you want to pass as opposed to collecting new payment info in an Element?

vagrant jasper
#

yes

#

maybe I need to update my code to this:

mint harbor
#

Then you can't do that with confirmPayment, it needs a Payment Element

vagrant jasper
#
stripe.confirmPayment({
                clientSecret: settings.clientSecret,
                confirmParams: {
                  return_url: settings.returnUrl
                }
              })
mint harbor
#

Actually, ignore me. I'm wrong

vagrant jasper
#

'elements' seems to be conditionnally required

mint harbor
#
stripe.confirmPayment({
  clientSecret: 'pi_xxx_secret_yyy',
  confirmParams: {
    payment_method: 'pm_xxx',
    return_url: 'https://example.com',
  },
})
.then(function(result) {
  if (result.error) {
    // Inform the customer that there was an error.
  }
});
vagrant jasper
#

ok I will try this then and let you knowx

#

Ok it seems like it worked, but it seems it did not use the Paypal payment method, but the credit card instead... this might be due to some other stuff maybe on my end

mint harbor
#

What was the pm_xxx ID you passed?

vagrant jasper
#

I think my question here is answered and was about the syntax

#

thank you

#

don't worry I will debug the rest of it 🙂

#

I'm not even sure it did not use Paypal

#

gotta check this

#

yes it seems I am the one not passing the correct PM ID

#

thank you for your help !

#

I can't even reproduce the bug for now, I was able to pay successfully with stored Paypal method this time using the syntax we talked about

#

thank you again

#

leaving now, have a good day 🙂

buoyant ermine
#

You too!