Reputation: 201
When I receive the subscription canceled webhook I can't retrieve the customers information via their payment info because it is deleted. Specifically I am trying to get the customers e-mail.
Upvotes: 2
Views: 350
Reputation: 743
Full disclosure: I work at Braintree.
You can extract the customer id from the webhook. You didn't specify your client library language, but this is how you would do it in Ruby:
webhook_notification = Braintree::WebhookNotification.parse(
bt_signature_param, bt_payload_param
)
customer_id = webhook_notification.subject.subscription.transactions.first.customer.id
Pass the customer id from your webhook into a Customer.find call. Then inspect the result object to extract the email address.
More information on parsing webhooks here.
If you have any additional questions, feel free to reach out to Braintree support.
Upvotes: 3