#alexcroox

1 messages · Page 1 of 1 (latest)

heady blazeBOT
gilded pasture
#

hello! let me check

#

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

runic fog
#

any chance I can update on the API and then call await elements.fetchUpdates from the client?

gilded pasture
#

that should work, can you try that in test mode?

runic fog
#

will give it a go, just didn't want to embark on it if impossible

gilded pasture
#

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

gilded pasture
#

@runic fog did that work?

runic fog
#

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

gilded pasture
#

can you share the request ID for that update request? can trace from there

runic fog
#

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
 },
gilded pasture
#

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)

runic fog
#

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

gilded pasture
#

looking at that one sec

#

so your requests did work, no?

heady blazeBOT
runic fog
#

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

gilded pasture
#

that's the last event for that PaymentIntent

runic fog
#

odd, it saved the card against the customer still for me

#

i.e was retrievable from stripe.paymentMethods.list

bronze elm
#

Hi @runic fog I'm taking over

#

Can you tell me what you expect vs what you actually got?

runic fog
#

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

bronze elm
#

as long as the setup_future_usage is set (either on_session or off_session), the assocaited payment method will be saved.

runic fog
#

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?

bronze elm
#

If you don't set setup_future_usage, the associated payment method won't be saved.

runic fog
#

is there a way to delete it from the PI? I'm thinking if a customer ticks the checkbox, then un-ticks. Each time I'm updating the PI setup_future_usage via my API

#

or can I send stripe.paymentIntents.update(piId, { setup_future_usage: null }) if they untick my save card option