当我收到取消订阅的 webhook 时,我无法通过付款信息检索客户信息,因为它已被删除。具体来说,我正在尝试获取客户的电子邮件。
最佳答案
全面披露:我在 Braintree 工作。
您可以从 webhook 中提取客户 ID。您没有指定客户端库语言,但在 Ruby 中可以这样做:
webhook_notification = Braintree::WebhookNotification.parse(
bt_signature_param, bt_payload_param
)
customer_id = webhook_notification.subject.subscription.transactions.first.customer.id
将客户 ID 从您的 Webhook 传递到 Customer.find 调用中。然后检查结果对象以提取电子邮件地址。
More information on parsing webhooks here .
如果您有任何其他问题,请随时联系Braintree support .
关于Braintree Webhooks : How can I notify customer that their subscription has been canceled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36039699/