#jessp1736

1 messages · Page 1 of 1 (latest)

coral jacinthBOT
misty harness
#

Hello what is it?

drowsy verge
#

I'm listening for two webhook events payment_method.attached and payment_method.detached. Will there always be a customer object if I were to retrieve the PaymentMethod and expand the customer?

misty harness
#

Not if it's not attached to a customer

drowsy verge
#

So it's likely that's the case for detached events

coral jacinthBOT
drowsy verge
#

I'm wondering if there is a way to retrieve the customer if I receive an event and the customer is not available.

misty harness
#

What do you mean?

drowsy verge
#

If I get a webhook event for payment_method.detached the customer data will not be present (presumably) , right?

formal moon
#

Hi 👋 I'm stepping in as @misty harness needs to go

drowsy verge
#

hello and thank you

formal moon
#

You are correct, there will not be a Customer associated with that PM as it is detached

drowsy verge
#

I do see on the event object there is a key called "previous_attributes" will it be avilable there?

#

I can see that it is populated on my test account event but I'd love to confirm that I can count on it being there.

formal moon
#

The test mode behavior will mirror live mode so you should test out detaching saved payment methods and inspecting the Event object returned by the webhook

drowsy verge
#

Awesome! Thank you