#susnet-dotnet-event
1 messages · Page 1 of 1 (latest)
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
But I still don't understand why the Customer property in code is of type Customer but in the event its type is string
Ah gotcha
If some properties are optional then this customer property should be null in that case and customer_id should be under customer_id
by default, the property is a string, it's what's documented: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-customer
What we support is turning that string into the full Customer object via the API via a feature called Expand: https://stripe.com/docs/expand
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
ok got it, thank you
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