#susnet-dotnet-event

1 messages · Page 1 of 1 (latest)

elfin forge
#

Hello! The event has the same structure as the object, it's just that some properties are optional. For example customer is only set if one was part of the Session but customer creation is optional in some cases

round hazel
#

But I still don't understand why the Customer property in code is of type Customer but in the event its type is string

elfin forge
#

Ah gotcha

round hazel
#

If some properties are optional then this customer property should be null in that case and customer_id should be under customer_id

elfin forge
#

So when you receive the Event it will always be a string, but if you retrieve the Checkout Session via the API you could expand the customer property into the full object

#

stripe-dotnet's support of expandable makes it so that it's always CustomerId for the string and Customer for the full object, same for all expandable properties

round hazel
#

ok got it, thank you

round hazel
#

How can I know which fields will be expanded in webhook event? For example checkout.session.completed with mode subscription has Subscription property expanded. I thought that webhook events are never expanded

dense prairie
#

Hmm, they shouldn't be expanded. Where are you seeing that the Subscription is expanded?

#

Do you have an example event ID where you're seeing the Subscription is expanded on that event?

round hazel
#

Sorry I was wrong, I looked at customer.subscription.created instead

#

all is okay