How to email a customer when their Stripe payment fails
When a renewal fails, Stripe fires invoice.payment_failed and starts retrying. Its recommended setting tries up to 8 times in two weeks. Unless you've turned on Stripe's own email, your customer has no idea. It's usually an expired card, not someone leaving, and I think those quiet two weeks are where you lose people who meant to stay. Below is the email I'd send the same day, and the few lines…
When a customer's Stripe payment fails, the system sends an event called `invoice.payment_failed`. While Stripe provides its own email notifications, it's often preferable to handle this event yourself. You can either enable Stripe's email notifications, create your own webhook endpoint, or use a service like Kicklace to send the notification.
To set up your own webhook, go to Stripe's revenue recovery settings, turn on "Send emails when card payments fail", and add a webhook endpoint. Verify each request by checking the signature on the `Stripe-Signature` header. Store the event IDs you've handled, as an event can arrive multiple times.
Kicklace offers a service that integrates with Stripe, listens for `invoice.payment_failed` events, and sends personalized emails to the affected customers. To use Kicklace, connect it to your Stripe account, provide the necessary restricted key, and write your own email template. Kicklace keeps the Stripe secret secure and marks the subscription as past due.
In your email, clearly communicate what happened, how to resolve the issue, and any consequences if the issue remains unresolved. Include a link to your billing page and, if desired, offer assistance. Remember not to blame the customer, and ensure your email aligns with your brand voice.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.