#jkas-source-delete

1 messages · Page 1 of 1 (latest)

hot craterBOT
errant sun
#

Do you have a specific question?

serene mauve
#

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?

errant sun
#

Taking a look now

serene mauve
#

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.

errant sun
#

Apologies for the wait. I'll circle back in a few minutes once I confer with a colleague

serene mauve
#

No problem, thanks for your help!

fallow void
#

@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.

#

jkas-source-delete

#

@serene mauve does that clarify the issue?

serene mauve
#

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.

fallow void
#

correct, there's no error or anything. This behaviour has existed for like 10 years

serene mauve
#

That's interesting to know. I will have to test it from the console. Is this behavior explained anywhere in the Stripe/API docs?

fallow void
#

also this part of the API is quite legacy. PaymentMethods were released in 2018 and have been the default integration path for years

serene mauve
#

It's possible we've been receiving this error for quite some time, but its visibility only surfaced recently!

fallow void
#

ah yeah that's possible

serene mauve
#

Ok, thank you. That's extremely useful information!

fallow void
#

Sure thing!

serene mauve
#

Have a great day!