diff --git a/endpoints/webhooks.py b/endpoints/webhooks.py index 6277724cf..370f5d20e 100644 --- a/endpoints/webhooks.py +++ b/endpoints/webhooks.py @@ -46,8 +46,10 @@ def stripe_webhook(): change_type = '' if event_type.endswith('.deleted'): plan_id = request_data['data']['object']['plan']['id'] - change_type = 'canceled %s' % plan_id - send_subscription_change(change_type, customer_id, cust_email, quay_username) + requested = bool(request_data.get('request')) + if requested: + change_type = 'canceled %s' % plan_id + send_subscription_change(change_type, customer_id, cust_email, quay_username) elif event_type.endswith('.created'): plan_id = request_data['data']['object']['plan']['id'] change_type = 'subscribed %s' % plan_id