#heisend3rp

1 messages ยท Page 1 of 1 (latest)

torpid waveBOT
gleaming rock
#

Hi there!

#

Can you share the PaymentIntent ID (pi_xxx) that has this error?

nimble monolith
#

req_6ucSzykOjDO7wH

#

pi_3MwOeBJ7hRt0Zipd1CxWJvED

#

I think I just made it work

#
    mode: 'payment',
    currency: (order.price.currencyCode ?? 'EUR').toLowerCase(),
    amount: 100,
    setup_future_usage: 'on_session',
  };```
gleaming rock
#

Thanks! Give me a few minutes to look into this.

nimble monolith
#

need to add it to Elements options

#

But now only card and sepa show up

gleaming rock
#

What are you trying to do exactly? You can set setup_future_usage: "on_session" when creating the PaymentIntent (like you did), and no need to do anything specific on the frontend. Just confirm the PaymentIntent and it should work.

nimble monolith
#

It didn't work this way

gleaming rock
#

What do you mean by it didn't work? Did you get an error message? Which one?

nimble monolith
#

one second

#

"The provided setup_future_usage (on_session) does not match the expected setup_future_usage (null). Try confirming with a Payment Intent that is configured to use the same parameters as Stripe Elements."

#

"pi_3MwP7lJ7hRt0Zipd15nNfaqw"

gleaming rock
#

Can you share the code you are using to confirm the PaymentIntent?

nimble monolith
#

if that changes sth

#
const { clientSecret } =
          res.data as OnOrderCallActionCheckoutResponseSuccess;

        if (!clientSecret || !stripe) {
          console.error('CheckoutForm - No clientSecret or stripe given!');

          return;
        }

        if (isSavedPaymentMethodSelected) return;

        stripe
          .confirmPayment({
            elements,
            clientSecret,
            confirmParams: {
              // setup_future_usage: 'on_session',
              return_url: `${window.location.origin}/${order.tenantId}/order-successful`,
            },
          })
          .then((err) => console.error(err));
gleaming rock
#

Not very familiar with that flow, give me a few minutes to try to reproduce the issue.

nimble monolith
#

okay. thank you ๐Ÿ™‚

umbral junco
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

nimble monolith
#

okay

#

still the same question

umbral junco
#

oh sorry I thought it was resolved

#

let me catch up

#

so basically if you want to add setup_future_usage in this flow you need to add it on elements.create and not on the confirmPayment call

#

ok so I see that you've already done that before

nimble monolith
#

yes

umbral junco
#

which payment method were you expecting?

nimble monolith
#

but this way only card and sepa_debit will show up, since the other payment methods are not compatible for saving

#

All of them

#

and to only save the method if its compatible for saving

#

this way the ux is a little bit more clunky

#

basically we would need to ask before if customer wants to save payment method or not

umbral junco
#

in this case you can use it with the confirmPayment but only for the PM types that accept s_f_u on_session

torpid waveBOT
umbral junco
nimble monolith
#

yes i know, in germany it's only card and sepa_debit

umbral junco
#

iDEAL also supports s_f_u

nimble monolith
#

Ok, will this change in the future?
I mean that it needs to be set in the Elements create too?

umbral junco
#

you don't need to pass them in both

nimble monolith
#

It's very weird now, since we just used a checkbox before to display at compatible payment methods. And ask if they want to save payment method for later

umbral junco
#

you either know ahead of time and you pass it in elements.create but this will only render the PM types that support s_f_u

#

or you need to add the s_f_u on confirmPaymentIntent but you would need to do some logic around whether the PM type supports s_f_u or not

nimble monolith
#

does this work with automatic payment methods?

umbral junco
#

if you don't pass sfu to elements.create then you will have a_p_m

nimble monolith
#

Thats what I tried before

#

Don't add s_f_u to elements.create, and add s_f_u and a_p_m to create payment intent

#

and thats not working

#

and s_f_u i couldn't add to confirm payment intent

umbral junco
#

don't add s_f_u to PI creation

umbral junco
nimble monolith
#

ahhh, so a_p_m doesn't work?

#

in create payment intent with s_f_u

umbral junco
#

actually I'm not sure give me a second, I'm a bit confused here

nimble monolith
#

pi_3MwP7lJ7hRt0Zipd15nNfaqw

#

i think it works, see here

#

create call with s_f_u and a_p_m

#

and it created an pi with "card" and "sepa_debit"

umbral junco
#

ok so basically, if you're expecting to confirm an s_f_u PI you need to add the sfu parameter to the Payment Element upon creation

#

which means you were right when you said that you need to ask the customer whether they want to save their PM for future usage ahead of time

nimble monolith
#

I can also change it afterwards

#

but it changes the available payment methods

#

it looks very clunky

#

Can you write a feature request for me?

#

๐Ÿ˜›

#

Payment Element is very nice, but saved payment methods are hard to make them work

haughty horizon
#

๐Ÿ‘‹ stepping in

#

Yep happy to file a feature request here

nimble monolith
#

I would like to give customerid (and ephemeral key if necessary) into the Payment Element. And then the payment element will display the customers saved payment methods. And also display checkbox to saved payment method to the given customers account

haughty horizon
#

This is something that we are actively working on

nimble monolith
#

Link actually sounds like a good alternative for this, since for us it's also available for other connected accounts.
But i guess it doesn't work with sepa

haughty horizon
#

Yeah not yet unfortunately

#

It will in the future!

nimble monolith
#

okay

#

thanks for all the help

#

and keep up the good work ๐Ÿ™‚