#wsteelix - set default payment method
1 messages ยท Page 1 of 1 (latest)
Hello, happy to help. What have you been trying so far? And what issues have you run in to with it?
Hi, thanks for super quick response!
my current flow is : create Customer -> create SetupIntent -> get client_secret (with payment_method_options: ['card', 'ideal']) -> render PaymentElement -> call stripe.confirmSetup with the element -> on redirect from a successful authorization, call stripe.retrieveSetupIntent with setup_intent_client_secret from the url query params -> create Subscription with the payment_method attached in the retrieved setupIntent in the previous step -> try to set the payment method with the same id above as default for future charge
and the last step always fail because it seems that the payment_method returned together with the retrieved setupIntent is different from the payment method that was earlier attached to the Customer object ๐ค
this is an example Customer: cus_LxwWWIs4bCL3yI
hope it was not too confusing ๐ i'll be happy to explain further if there's anything unclear ๐โโ๏ธ
Thank you for the clarification. Would you be able to try the last step again and send me the request ID from that call (req_123) so that I can look at the specific error that you are getting?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hi, this was the request id: req_zlyHuscXoZnfR7
Thanks!
So you have two options here. If you know which customer the payment method goes to before you create the SetupIntent, you can pass their ID to the customer parameter, which should mean that the payment method it creates is automatically associated with that customer https://stripe.com/docs/api/setup_intents/create#create_setup_intent-customer
Otherwise, you will need to make a separate call to attach the payment method to the customer https://stripe.com/docs/api/payment_methods/attach
If you make that call and attach the payment method and customer that you just tried this with, the error should go away when you try again
the thing is that we already pass the customer ID to the call to create SetupIntent
for example if you can have a look at this Customer events and logs: cus_LxwWWIs4bCL3yI
there's a successful payment_method.attached event
the weird thing was that on this payment_method.attached event evt_1LG0eELiXZrLhRYlioy6U88j, the id of the payment method was: pm_1LG0eELiXZrLhRYl8t21uJC3
but then on the next setup_intent.succeeded event evt_1LG0eELiXZrLhRYlXrBOIl35, it contains a completely different payment_method id: pm_1LG0dqLiXZrLhRYlAcHUYH9u
so I was wondering why and how this happens
Interesting. I thought that that was not in our logs when I checked it. Thank you for the new IDs, will check in to them in a moment
sure. thanks! and please take your time ๐
Thanks for the IDs and the patience. I am still unsure why this setup intent is behaving like this. I will reach out to my colleagues who may know more on this and will get back to you with what we can find
sure thing. Thanks a lot! I have the same feeling also. because our setup has worked so well with cards so far. We're now planning to implement SEPA bank redirect, and has stumbled on this weird issue ๐
btw, should i expect your colleagues respond anytime soon? I'm already over time, and if not then I can close the laptop and get back at this tomorrow ๐ค
Apologies for the delay. Don't want to make you stay later, would you mind writing in a quick email to support@stripe.com mentioning these events and that you spoke to Pompey on Discord, and then DM-ing me your email?
I can pick up the ticket right away and we can have an answer there before you get back tomorrow
Otherwise it shouldn't be too long but again I don't want to make you stay past when you should
sure thing! I will shoot an email that way right away
Thanks! Apologies this took a bit already
no worries, I can see that you're handling multiple requests at once ๐
Thanks for the email, grabbing it now
ah... supposed to dm you the email address, sorry ๐
No worries, happens all the time! We are mostly worried about bots crawling for people to spam but I don't think they are that on top of our threads
alrighty! thanks a lot!
Perfect. I can see your email and assigned myself. Have a good rest of your day!