#Muhammad Awais
1 messages · Page 1 of 1 (latest)
Potentially yes. Your integration should assume 3DS/auth could be requested for all payments regardless of card country/origin
And it always have to be redirected another website?
I am integrating the stripe in SPA
What's the actual problem you're trying to solve?
I am just trying to handle all the case for stripe elements
Ok, but why would US cards be different? If you're using confirmPayment then the integration will handle all 3DS redirects automatically
I read somewhere that 3D secure is mostly in European countries
it can redirect to another website right?
that's why we provide the return_url
Sure, there's regulation that around authentication for online payments in Europe: https://stripe.com/docs/strong-customer-authentication/sca-enforcement
Just not sure why that'd concern you if you're using Elements and Stripe.js – that integration will handle 3DS for all cards whenever requested, regardless of country
Because of this
Because I have SPA, if a user will be redirected to another website, user's data will be lost because I am not saving all the information until user pay
Yes, there's details on this here: https://stripe.com/docs/payments/3d-secure#when-to-use-3d-secure
You can opt to include the 3DS UI in an iframe on your own page if you prefer
Then I'd recommend passing state to the return_url as URL parameters
ok
I have asked the user billing details, captured the required amount,
Now I have created another off session payment intent and it throws an error
How can I update my existing stripe element for this new payment intent?
What's the error?
Maybe insufficient funds
elements.value = stripe.value.elements(
{clientSecret: paymentIntent.clientSecret}
)
would that work?
How can I update my existing stripe element for this new payment intent?
You'd have to create a new Elements instance with the newclient_secret. Alternatively, if your amount varies before your users pay consider the deferred flow: https://stripe.com/docs/payments/accept-a-payment-deferred
so above won't work?
I think that's replacing the old elemnts with new one?
No I don't think it will
Is there a method to unmount the existing element?
But that won't help for what you need to do. You don't need to unmount the Payment Element, but the Elements instance
so cardElement.destroy(); ?
As I said, if you're Payment Intent values are constantly updating (like a cart scenario where your customers update quantities, add/remove items) then you're better off using the deferred flow
Are you using Payment Element or Card Element?
Then I'm not sure why you're passing the clientSecret argument to the Elements instance
That's only needed for the Payment Element, otherwise you pass ity when you call confirmCardPayment
Ok, so you are using the Payment Element
I was thinking this is a card element, what's the diff?
so for payment element what do I need to do to assign another payment intent's client secret?
You need to initialise a new Elements object via elements.create. They can't be updated