#esset09
1 messages · Page 1 of 1 (latest)
OK. Is there a workaround of some sort? Or, can/should I assign metadata to the "invoice" and listen to "invoice.paid" rather than "payment_intent.succeeded"?
in all cases you should listen to invoice.paid
it has information that the payment_intent doesn't have
ok, thanks
If an invoice payment gets refunded; it would also trigger a charge.refunded event, right? Would that event contain any of the metadata added when the invoice was created?
or, would it rather trigger an "invoice.voided" event?
(e.g. in the case where a customer disputes the payment, and it gets refunded)
hi! I'm taking over this thread.
when you receive the payload with a PaymentIntent, you can make one extra API wall to retrieve the associated invoice to find all the metadata you need
or you can manually copy the metadat from the Invoice onto the PaymentIntent object
OK. It's fine for us to use the invoice.paid event as well.
Have you had a chance to review the refund question? We need to have some way of understanding which invoice (or rather; its metadata containing our internal identifiers) that got refunded
If an invoice payment gets refunded; it would also trigger a charge.refunded event, right?
yes
Would that event contain any of the metadata added when the invoice was created?
no, it would contain a Charge object, not an Invoice object. So the Invoice metadata won't be there
OK, is there any way to find the invoice based on the charge? E.g. a refernece ID or such?
Sure: the Charg contains a reference the PayemntIntent, and the PaymentIntent contains a reference to the Invoice.
and you can use expand to get all of this in one API call: https://stripe.com/docs/expand
ok, cool, so when retrieving the charge, I would choose to expand "payment_intent.invoice" (using Nodejs lib)?