#antoineb_docs
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1415257066506817607
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
So, just to summarize :
Currently I have :
- CardElement with payment intent creation + confirmation on the server
- PayPal, with client asking for payment intent creation on the server then confirms it (with redirectio and so on)
We want to migrate to PaymentElement, and first I saw that Stripe suggests that the PayPal flow we currently have should be generalized (if I understand well) But we're not super comfortable because currently our flow is not super robust with paypal (the booking is created after the redirection, the client asks it directly instead of via a webhook).
But then I saw this doc :
https://docs.stripe.com/payments/finalize-payments-on-the-server
And wonder if we could do this and how it would work with PayPal
This should work for you I think: https://docs.stripe.com/payments/paypal/accept-a-payment?web-or-mobile=web&payment-ui=direct-api#handle-redirect
There'll still be a client-side redirect to PayPal naturally, that is unavoidable
thanks, looking into it right now
so, just to be sure I understand what you just sent, this would make Paypal payments be confirmed on the server?
And this would work well with payment Element ?
Would that work with stripe React native as well?
Yes, you can confirm them server-side either via confirm: true or using the /confirm endpoint. But as I said it'll just transition to a requires_action for you to manually handle the redirect
And this would work well with payment Element ?
I don't believe so, you'd likely need a Confirmation Token for that: https://docs.stripe.com/payments/finalize-payments-on-the-server?platform=web&type=payment
Would that work with stripe React native as well?
Not sure to be honest, I'd need to check. I believe so
thanks, I saw the confirmation token logic. Would this confirmation token logic would work with paypal as well then? The idea would be to use payment element for all payment methods, and it would be better for us to use the confirmation token logic for cards, so I was wondering if this was OK with paypal
Yes, CT works with most PMs inc. PayPal
thanks, and how the redirection is handled if we use CT then? ๐ค
amazing! thank you for pointing me to the right info ๐
I'm not a front end dev, but my workmate told me that things were always a bit different with stripe react native. Does the confirmation token logic works also with payment element in stripe react native?
Yeah unfortunately I don't see any similar CT methods in the RN SDK: https://stripe.dev/stripe-react-native/api-reference/index.html
So I'd guess not
Documentation for @stripe/stripe-react-native
ah :/ and no server side confirmation at all on stripe react native then?
You can do this flow, but not with a CT
ah yes, but since we want to migrate to PaymentElement for both web and app I guess we're stuck ? Since the flow you mention is not with payment element, and the CT is with payment element
You might be able to get by with createPaymentMethod instead of CT: https://stripe.dev/stripe-react-native/api-reference/functions/createPaymentMethod.html
Documentation for @stripe/stripe-react-native
thanks, looking into it
Maybe I'm not front-end tech savy enough, but I'm not sure how this would allow server side payment confirmation for payment element react native ๐ค
Because you'd tokenize the PM data selected (be that card, PayPal) in the Payment Element via createPaymentMethod and send the resulting pm_xxx ID to your backend to confirm the intent
and if the user re-uses a payment method instead of creating one?
Well how are you enabling that re-use functionality? But you'd just skip the createPaymentMethod part and instead send the existing, chosen pm_xxx ID to the server-side and the flow is identical
ok, I see. I'd have to ask the frontend team how they would do it.
Thank you, I'm going to check with my team. You've been super helpful ๐
No problem, glad I could help!