#barney-laurance_api
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/1367822383385149450
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
You'd omit the setup_future_usage param on the intent and use a Customer Session to render a 'save' checkbox
When the customer does not tick the box to save payment details I would prefer to honour their instruction by not saving the details. Currently they are saved and attached to the customer when we confirm, so we have to avoid presenting them to the customer when they look at saved cards, and I feel we need to implement something to search through the customer records and detach all these cards that the customer didn't want saved. If we can avoid saving them in the first place that would be much better.
Btw our application code is all public on github so happy to share links to any relavent parts.
Sounds like you're setting s_f_u then which will save irregardless of the checkbox. Got an example?
You'd omit the setup_future_usage param on the intent and use a Customer Session to render a 'save' checkbox
Thanks but at the time we create the intent we don't know if the customer is going to tick the "Save payment details for future purchases" box or not. If they do tick it then we do want to save it.
Sure, which is the flow that the guide I linked outlines
- Create a payment without
s_f_u - Configure the Payment Element to allow customer to save the details if they want
- If they check the box, it's saved, otherwise it's discarded post payment
Hi this is a test customer I just made, I did not tick the box when I made the payment, but I was still able to use the card to make another payment later if I later edited the BE code to tell stripe not to filter it out. https://dashboard.stripe.com/test/customers/cus_SEkJJrSjFdO5hW
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
When confirming the PaymentIntent, Stripe.js automatically controls setting setup_future_usage on the PaymentIntent and allow_redisplay on the PaymentMethod, depending on whether the customer checked the box to save their payment details.
https://docs.stripe.com/payments/save-during-payment#enable-saving-the-payment-method-in-the-payment-element
Seems expected given that you set s_f_u: 'on_session' when creating the CT: https://dashboard.stripe.com/test/logs/req_rmcU2nw0z0G2jo
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Or at least that is set somehow
OK thank you - sounds like we just need to change it to null here then https://github.com/thebiggive/donate-frontend/blob/273e57eb2adb5710dddcd2737e566fa1c606b62b/src/app/stripe.service.ts#L172 . I'll try that. It's a while since we worked on this area of the site, I feel like we had problems doing that before in the case when the customer did want to save the card, but I just tested now on my local and it does look like the tickbox still appears.
Am I right to think that if we set that to null then Stripe should attach the PM to the customer if and only if they tick the box?
sounds like we just need to change it to null here then
Yes, if you pass a value there that will take precedence over the customer facing checkbox and we'll save regardless
Am I right to think that if we set that to null then Stripe should attach the PM to the customer if and only if they tick the box?
Yes, as outlined here
Great I will try adjusting that thank you. Then we'll just need to do a one-off job to clear the PMs we've saved that we can't use.
If they tick the box how does stripe know whether to save the card for on session or off session use?
You'd configure it when creating the Customer Session: https://docs.stripe.com/api/customer_sessions/create#create_customer_session-components-payment_element-features-payment_method_save_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
right thank you and we are already setting that to on_session when we create the session: https://github.com/thebiggive/matchbot/blob/f13a52990b3622e49d3614e6a4267f85e711ba7e/src/Client/LiveStripeClient.php#L37
Perfect, then just removing this setupFutureUsage line should fix your issue
I 'm going to test that out. Would you like me to let you know later / next week if it all seems to work?
My tech lead Noel might join the discussion here later as well.
Thanks again ynnoj.