#neil_code
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/1311403622453477377
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
You are using the deferred-intent flow here?
Meaning you are following these docs: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#save-payment-methods ?
Close, we need to confirm on the server so following these docs: https://docs.stripe.com/payments/finalize-payments-on-the-server
Gotcha, and your goal is to ensure that the customer does save their PaymentMethod for redisplay every time?
save their PaymentMethod for redisplay every time
yes and more importantly saves their payment method for future off-session payments
^ I've confirmed that part is working. When the checkbox is selected the rest of the options are configured such that off-session paymetns are working
just need to enforce that the checkbox gets selected
oh wait, are you about to tell me that setup_future_usage: off_session takes care of that?
and checkbox is just for redisplay purpose?
Okay gotcha. So really what you want here is to not use a Customer Session at all for saving a new PaymentMethod. Instead, you set setupFutureUsage when creating your Elements object and you set setup_future_usage server-side when confirming your PaymentIntent.
When you create the confirmationToken you can set payment_method_data.allow_redisplay: 'always': https://docs.stripe.com/js/confirmation_tokens/create_confirmation_token
But overall, yes, what you just stated is correct -- the checkbox there is only to give the customer the choice on whether their PaymentMethod should be redisplayed or not.
The actual dictation of whether it is saved or not is based on setup_future_usage.
I see, super helpful. Thanks. Will let you know how it goes
๐
just to confirm, does it hurt to use the customer session or you recommend booting that all together?
You do want to use the Customer Session if you want to redisplay saved PaymentMethods in Payment Element, yes.