#heisend3rp
1 messages ยท Page 1 of 1 (latest)
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',
};```
Thanks! Give me a few minutes to look into this.
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.
It didn't work this way
And if you want to add setup_future_usage only for some payment method, you can here: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_options
What do you mean by it didn't work? Did you get an error message? Which one?
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"
Can you share the code you are using to confirm the PaymentIntent?
btw we are using this flow: https://stripe.com/docs/payments/accept-a-payment-deferred?type=payment
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));
Not very familiar with that flow, give me a few minutes to try to reproduce the issue.
okay. thank you ๐
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
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
as described here https://stripe.com/docs/payments/accept-a-payment-deferred?type=payment#additional-options
ok so I see that you've already done that before
I'm referring to this
yes
which payment method were you expecting?
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
in this case you can use it with the confirmPayment but only for the PM types that accept s_f_u on_session
you can look at this list https://stripe.com/docs/payments/payment-methods/integration-options#additional-api-supportability to see whether a PM type supports s_f_u
yes i know, in germany it's only card and sepa_debit
iDEAL also supports s_f_u
Ok, will this change in the future?
I mean that it needs to be set in the Elements create too?
you don't need to pass them in both
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
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
does this work with automatic payment methods?
if you don't pass sfu to elements.create then you will have a_p_m
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
don't add s_f_u to PI creation
you can't pass it if the PM type is not compatible
actually I'm not sure give me a second, I'm a bit confused here
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"
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
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
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
This is something that we are actively working on
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