#jkas-source-delete
1 messages · Page 1 of 1 (latest)
Do you have a specific question?
Yes
There is a "Stripe automatically updated a payment source" event that triggers a customer.source.updated webhook event.
If you look at that event, the payload is telling our backend that it's in a chargable status.
Our backend then parses the payload and re-saves the default payment source on the stripe customer object.
You can look at the logs, and see that our requests to save this updated source back to the customer is failing due to the source status now being consumed
My confusion - where is the event to mark this source as consumed? We should be listening to that one as well.
Why would the source be quickly marked as consumed after this auto-update?
Taking a look now
It looks like, roughly ~3 seconds after the customer.source.updated webhook happened there was a POST request made by your system to delete the source: https://dashboard.stripe.com/events/evt_1MtQsQEkTO8kaKcK8G8gJpuW
a POST request to delete an object?
Or a DELETE request?
Or is it something else - a detatch request at the customer-scope?
We never explicitly call detach in our codebase. I'm curious how this request to delete the source could be coming from us.
Apologies for the wait. I'll circle back in a few minutes once I confer with a colleague
No problem, thanks for your help!
@serene mauve when you call the Update Customer API and pass source: xxxx this makes that object the new "default source" and automatically deletes the old one.
that's what your code did in https://dashboard.stripe.com/logs/req_GTkQY74ENtteNa
jkas-source-delete
@serene mauve does that clarify the issue?
I'm reading your comments now
Ok, so what happens on Stripe's side if we try to set the source on the customer to the existing source on the customer?
I think that might be what's happening here. Will doing this result in this error?
It seems like updating the source on the customer has a side effect in Stripe of first [detaching and] consuming the "old" source before attaching the new one.
correct, there's no error or anything. This behaviour has existed for like 10 years
That's interesting to know. I will have to test it from the console. Is this behavior explained anywhere in the Stripe/API docs?
also this part of the API is quite legacy. PaymentMethods were released in 2018 and have been the default integration path for years
It's possible we've been receiving this error for quite some time, but its visibility only surfaced recently!
ah yeah that's possible
Ok, thank you. That's extremely useful information!
Sure thing!
Have a great day!