Oliver Nassar

Stripe: Failed invoices vs failed charges

February 01, 2014

Another post for me to remember some obscure tech fact:

With Share As Image, we're using monthly recurring plans
We're also using Stripe webhooks for some maintenance around provincial taxation
Stripe sends the following two (among other) event types: invoice.payment_failed and charge.failed

I was a little confused around the two
When a person is subscribed to a monthly recurring plan, and their payment does not go through, both an invoice.payment_failed and charge.failed event webhook is fired
Note that sometimes these events don't go through in the same order
Sometimes the charge.failed is sent first; otherwise second
The time between the two charges seems to be variable too; sometimes upwards of 60 seconds

However I was also seeing charge.failed events being sent to the server, that didn't seem to be tied to an invoice (which is also associated with a plan)
Those can happen when a subscription is initially attempted to be created for a Stripe customer, but the card doesn't go through
For example, the credit card company declines the transaction

Hope that helps
For more info: https://www.petekeen.net/stripe-webhook-event-cheatsheet