codecov / engineering-team

This is a general repo to use with GH Projects
1 stars 1 forks source link

Email admins of an account when a billing charge is failed #2348

Open aj-codecov opened 2 months ago

aj-codecov commented 2 months ago

Created a couple subtasks below but then thought against being too prescriptive.

Highlevel, we want to support sending emails to all the admins of an organization when a customer has a failed payment for their stripe subscription.

When this occurs, stripe sends us an "invoice payment failed" webhook, which, within the payload contains a payment failure "reason."

We want to use this "reason" as the basis for selecting one of a range of templates to send to each of the admins for that organization. Looking at the stripe dashboard, our top 3 reasons are insufficient funds, do not honor, and try again later. We may want to do a little research to see if things are trending more toward some other reasons more recently, since we've done a lot of billing updates in the last quarter too.

From there, once we have the templates built, and the ability to grab all the admins for an organization, we want to utilize the SendEmail task (SendGrid under the hood) that @joseph-sentry built a while back to actually send these emails to the end user.

My understanding so far is that this should work out of the box. Just a heads up, it was built around a year ago and may need a little bit of tweaking, updating, etc in case the sendgrid API changed or has additional features now or something.

Once we have the basis setup for sending emails to admins for this first webhook, "invoice_payment_failed," we will be able to add additional emails and templates in the future much, much easier.

Figma: https://www.figma.com/design/rFhCssa2bQzI0wN558vQXF/GH-2348?node-id=1-2

katia-sentry commented 2 months ago

@aj-codecov @codecov/design Will we need designs for this?

Adal3n3 commented 2 months ago

@katia-sentry We will need a Codecov email template and then craft the email copy. I will find the template from Marketing.

lindsayrpiper commented 2 months ago

@aj-codecov @Adal3n3 - would this be expected to be an automated email?

Adal3n3 commented 2 months ago

Yes - we will trigger an automated email when a payment has failed @lindsayrpiper

Adal3n3 commented 3 weeks ago

Meeting note 10/9 on slack thread: https://sentry.slack.com/archives/C04MTDH3ZQA/p1728508834438339