#DramaLlama-invoice-events

1 messages ยท Page 1 of 1 (latest)

kind viper
sand ivy
#

alternatively I could not listen to invoice.payment_action_required I suppose and just check the flag in payment_failed to see what kind of email to send to the customer

#

I am curious to why payment_failed event is sent. Strictly speaking the payment hasn't failed right?

It just isn't done processing and needs a manual step

mild cairn
#

Hey ๐Ÿ‘‹ apologies for the delay, please bear with me a moment while I read through this.

#

While I do, could you provide a link to the documentation you're referring to, just to make sure we're on the same page (pun intended).

sand ivy
#

Absolutely!

#

direct link to the section

mild cairn
#

Thank you for that, let me double check if there is any other reason a PaymentIntent would go into a requires_action state, other than requiring authentication.

sand ivy
#

what is the flow you would recomment?

listen to payment_failed, and send action email to customer if requires_action = true

or, ignore payment_failed when requires_action = true and instead also listen to requires_action webhook?

mild cairn
#

In my opinion, it depends on whether or not you're planning to receive payment_failed for any other reason.

If so, I'd listen to those events and then check the requires_action value inside of the block processing the event.

If you don't plan on doing anything else with payment_failed events, then I'd subscribe to the payment_action_required events instead.

sand ivy
#

I do use payment_failed to send out an unpaid invoice normally.

Which in truth is what I will do now aswell with action_required. With the one difference that I will have a link in the email

#

So makes sense that I just listen for payment_failed

#

Can I just double check my flow with you.

  1. Recieve payment_failed with requires_action.
  2. Send email to my customer to link them to a page, and send with the invocie id (that I took from step 1).
  3. When customer loads page, take invoice id, look up invoice.payment_intent (is that always set?)
  4. Get payment_intent and get intent.client_secret.
  5. Now in the view I serve the user I use stripe.js and run stripe.confirmCardPayment(clientSecret)

And that takes care of everything?

#

Is that a correct flow?

mild cairn
#

Running through a test scenario to confirm.

sand ivy
#

Fantastic, thanks!

mild cairn
#

Thanks for your patience! Those steps looked right, but I just wanted to double check and my test flow using them worked as expected.

sand ivy
#

awesome, really appreciate the help there!

#

Then I should be able to finish this rather quick

#

So is it fine to have your invoice id (in_654897789) in the url I email customer

mild cairn
#

That's fine, it's just an identifier. It's not a sensitive value like the client_secret.

sand ivy
#

Fantastic!

Then this should be done in a flash, thanks!

mild cairn
#

Glad to hear! If there is ever anything else we can help with, we'll be here ๐Ÿ˜„