#Kekox123 - Customer Update Events
1 messages ยท Page 1 of 1 (latest)
Let me find those ๐
First event with the old default payment source evt_1KtLQHKNEK8dUItSk84iDoNs
Second event with the new default payment source evt_1KtLQHKNEK8dUItSW5XhxG1o
This behavior is expected. These two events are showing you two distinct changes made separately to this Customer. One event was generated by this request: https://dashboard.stripe.com/test/logs/req_ERdfByGBLnev28. The other event was generated by this request: https://dashboard.stripe.com/test/logs/req_VARQvghTZsc241
If you don't want two events you can make those changes in a single request instead.
Does that help?
Yes it helps a lot, I'm calling this before setting the new default payment method:
const bankAccount = await stripe.customers.createSource(customerId, {source: bankAccountToken});
Which triggers the customer.updated event right?
Yep.
๐ I am taking over and catching up
So... I'm doing that to verify the bank account and bind the bank account to the customer and after that I set it as the default one, is there a way to do all in just one update? haha
But am I doing it right? i.e. should I create the payment method and bind it to the customer first and then set it as default?
I mean I want the new payment method to be default so I can generate invoices to that payment method later.
Yes you are doing it right, no worry!
It's just by design you still need to split into 2 requests
Well that's good to hear haha, sounds like I need to check the default_source vs invoice_settings.default_payment_method fields to know when is safe to store the payment_method_id