I am calling a function in case 'invoice.payment_succeeded' that requires the customer's email as input. How do I get the email from this event object? the app is nodejs.
Thanks,
CodePudding user response:
All invoice webhook events (including invoice.payment_succeeded
) will contain the related Invoice object in the event payload, under the object.data
field.
The Invoice object will contain a customer_email
field which is a snapshot of the email
field on the associated Customer object at the time of the invoice.