djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

fundraising: 'customer.subscription.deleted' webhook event always gets 404 response

Open Parbhat opened this issue 8 years ago • 5 comments

The response to stripe 'customer.subscription.deleted' webhook event is always 404. The reason is:

In the cancel_donation view, stripe_subscription_id is set to an empty string https://github.com/django/djangoproject.com/blob/e5a4bf20fb58c463441c15d552c022b03f716858/fundraising/views.py#L178

In the subscription_cancelled webhook handler method, the donation object is fetched using stripe_subscription_id which was set to an empty string earlier.

https://github.com/django/djangoproject.com/blob/e5a4bf20fb58c463441c15d552c022b03f716858/fundraising/views.py#L232-L233

So, the response will always be 404 and no cancellation email will be sent to the donor.

Parbhat avatar May 04 '17 13:05 Parbhat

@timgraham if this looks okay, Can I send a PR?

Parbhat avatar May 31 '17 05:05 Parbhat

I haven't confirmed the issue. If you have, feel free to propose a fix.

timgraham avatar May 31 '17 10:05 timgraham

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 06 '22 20:10 stale[bot]

The problem seems plausible. I suppose removing donation.stripe_subscription_id = '' from the cancel donation view would fix this. As long as the stripe webhook comes through, it will run the same statement. I'm not sure if there would be a noticeable delay for the user though (and if the webhook wasn't received for some reason, our database would be out of sync).

timgraham avatar Oct 07 '22 01:10 timgraham

This issue still persists: https://github.com/django/djangoproject.com/blob/main/fundraising/views.py#L178

@Parbhat Would you like to send-in a PR?

CuriousLearner avatar Apr 10 '23 20:04 CuriousLearner

@CuriousLearner I would like to send the PR

coderr01 avatar May 03 '23 13:05 coderr01