#Codex-invoice-advancement
1 messages · Page 1 of 1 (latest)
Yes, I can DM you
It's safe to share the Invoice ID (in_xxx) here
in_0Ke5L3uagHrUveG4NFxKyhFO
We noticed that we were not receiving the invoice.payment_failed webhook event for some failed invoices. And it looks like the "auto_advance" field was changed, which may have been something to do with it?
For that particular invoice auto_advance was set to false because the Subscription that created it was canceled (which will set auto_advance: false for any open invoices on the subscription). Let me dig a bit more tosee why invoice.payment_failed wasn't sent
Ahh alright, I see.
And yes, thank you, invoice.payment_failed is what we are trying to find out mainly
I also see why the invoice.payment_failed event wasn't sent for that invoice - the payment attempt that failed was triggere through a server-side call to the /v1/invoices/in_xxx/pay endpoint. We only send invoice.payment_failed events when payment fails as part of the payment attempts that stripe automatically makes (like during subscription renewal or payment retries).
Oh I see. It does look like the card was declined, and it was a first-time subscription purchase (not a renewal)
So then invoice.payment_failed is only applicable to renewal events?
Just went and double checked - so you can also get the invoice.payment_failed event from subscription creation failure. It's just the explicit requests to the "pay invoice" endpoint that won't trigger the event
Is the "pay invoice" endpoint being triggered on Stripe's side automatically?
No, the pay invoice endpoint is something that you're specifically hitting. We pay invoices through other internal engines, not through the external "pay invoice" endpoint
Alright, I see. Is there any way to trigger invoice.payment_failed in this case, when our side hits the /pay endpoint?
No, there isn't any way for you to force an invoice.payment_failed event to be triggered - but it should still trigger a payment_intent.payment_failed event if that helps. You should also know from the response back from stripe whether the payment failed or not
That's true. Then in what case does invoice.payment_failed event send from subscription creation failure?
As in, if the payment intent succeeds, how can the invoice fail? (and then send that webhook)?
If the payment intent is successful there's no way for the invoice to fail
Sorry, I meant this instance you mentioned
Can you rephrase your question - I think I'm not understanding exactly what you're trying to ask, so rephrasing it may help
Yes, sorry. You mentioned that "you can also get the invoice.payment_failed event from subscription creation failure"
If the payment intent is successful, what cases can the subscription creation fail?
If the paymet intent is successful that means the subscription was also successfully created. What I meant is that during subscription creation if things like authentication failed, or the card was declined, you'd get both a invoice.payment_failed and a payment_intent.payment_failed event. Does that make sense?
Ahh okay, that makes sense. Thanks for all your help