#alexcroox
1 messages · Page 1 of 1 (latest)
hello! let me check
I was hoping to use stripe.paymentIntents.update() but the docs indicate it's not possible the way I'm doing it?
this is supported? https://stripe.com/docs/api/payment_intents/update#update_payment_intent-setup_future_usage
ah sorry I see what you mean
it only goes from on_session -> off_session with a publishable key meaning if you're updating it during the /confirm call when calling confirmPayment() on PaymentElement
any chance I can update on the API and then call await elements.fetchUpdates from the client?
that should work, can you try that in test mode?
will give it a go, just didn't want to embark on it if impossible
tbc using stripe.PaymentIntents.update() should allow updating setup_future_usage to either enum, I don't know about fetchUpdates() bit so recommend trying that out and letting me know
@runic fog did that work?
just testing now, 2 mins
no it didn't. Created the paymentIntent, then FE called BE to update PI to "on_session", then FE called await this.elements.fetchUpdates() no errors etc. Payment went through, but it looks like it still setup the card for future use
I could technically make the default "on_session", but what if the customer accidentally clicks "remember my card" then unticks it again, if the API won't let me change it back to on_session?
Stripe logs show my request to change to on_session was successful
can you share the request ID for that update request? can trace from there
sure req_wlc0J3csIHxn8z
I've even tried creating the PI without specifying setup_future_usage hoping Stripe elements might provide it's own UI for saving or not saving the card like it does in iOS (?) but nothing appeared.
Stripe iOS checkbox not available in web?
I'm using JS stripe.confirmPayment, I notice stripe.confirmCardPayment has an option to set setup_future_usage. What's the difference between confirmPayment vs confirmCardPayment?
Can I swap them out safely? My BE uses:
automatic_payment_methods: {
enabled: true
},
sorry server got busy so I missed this, responding top down
hoping Stripe elements might provide it's own UI for saving or not saving the card like it does in iOS (?) but nothing appeared.
yeah Stripe Elements doesn't have that, iOS / Android SDKs' Payment Element offers that only
Stripe iOS checkbox not available in web?
yep not supported there afaik
I'm using JS stripe.confirmPayment, I notice stripe.confirmCardPayment has an option to set setup_future_usage. What's the difference between confirmPayment vs confirmCardPayment?
confirmPayment()is used with Payment Element in web
confirmCardPayment() was before we had Payment Element, it is used with Card Element (the card only UI preceding Payment Element)
did my request shed any light into why it's not allowing the customer to toggle between save/don't save during checkout? req_wlc0J3csIHxn8z
I'm surprised by the lack of examples of others trying this. Would have thought showing UI to save card or not during checkout would be a common use case
looking at that one sec
so your requests did work, no?
you set on_session: https://dashboard.stripe.com/test/logs/req_DnLr1gMfc52Jlq
then off_session: https://dashboard.stripe.com/test/logs/req_xseg9GF9HxSS8N
then back on_session: https://dashboard.stripe.com/test/logs/req_wlc0J3csIHxn8z
and then confirmed it so it stayed on_session?
no it reverted back to off_session
ie the last update was on_session, but final action when confirmPayment still seemed to save the card, and the PI shows the status as being off_session
where? the PaymentIntent shows on_session https://dashboard.stripe.com/test/events/evt_3NcZ1bHrOckIIojh0PG3U9Fz
that's the last event for that PaymentIntent
odd, it saved the card against the customer still for me
i.e was retrievable from stripe.paymentMethods.list
Hi @runic fog I'm taking over
Can you tell me what you expect vs what you actually got?
I wanted the customer to be able to toggle a checkbox that means I will either save their card for their next checkout, or not
I processed a payment for a new customer where I updated the PI to use on_session instead of off_session, but after payment when I call stripe.paymentMethods.list it returned the card I just used, I was expecting it to return no cards since I decided to use on_session which I assume wouldn't save the card
as long as the setup_future_usage is set (either on_session or off_session), the assocaited payment method will be saved.
ah OK, is there a way to filter the cards based on setup_future_usage at the time, or am I going to have to build my own Stripe card db reference table to store that?
If you don't set setup_future_usage, the associated payment method won't be saved.