mysociety / mapit.mysociety.org

A Django project for running mySociety's main instance of MapIt for the UK
http://mapit.mysociety.org
Other
6 stars 2 forks source link

Change sending of payment failure emails #159

Open dracos opened 1 month ago

dracos commented 1 month ago

Normally, if we attempt payment and it fails, we get a payment_failed event with a next_payment_attempt set to show Stripe will try again, and we send an email saying payment has failed, please sort it. Then if we get the same type of event with no next_payment_attempt, we send an email saying it's been cancelled, as we won't have taken any payment.

However, we had a situation recently where a subscription rolled over, payment was attempted but the card required 3DS confirmation, so the payment failed and Stripe sent the customer an email to do the 3DS check (which they did, and the payment went through fine). However, the payment_failed event we received didn't have a next_payment_attempt set (presumably because it wasn't going to), so we sent a "subscription has been cancelled" email, which was confusing as they'd also got an email from Stripe and confirmed their payment (and their subscription was not cancelled).

I think we should: