#aaparth-subscription-payment-failed

1 messages · Page 1 of 1 (latest)

glossy tendon
#

Hello! There won't be any data relating to a failed payment on the Payment Intent object. You'll also need to expand the charges field on the PI object:

const invoice = await stripe.invoices.retrieve(data.invoice_id, {
  expand: ['payment_intent.charges']
}); 
upbeat spruce
#

okay

#

I have expanded payment_intent.charges

what should I look for in the response

glossy tendon
#

They have fields pertaining to failure reasons/codes

upbeat spruce
#

now lets say there were 3 retry so the charges will have 3 object correct ?

#

if yes then which one will be the latest, the top one or the last one ?

glossy tendon
#

The first object in the array will be most recent

upbeat spruce
#

okay thanks a lot

glossy tendon
#

Np!

upbeat spruce
#

please don't archive this thread, if all good then I will let you know to archive it

upbeat spruce
glossy tendon
#

Be something like:

$stripe-invoices->retrieve(
  'in_xxx',
  ['expand' => ['payment_intent.charges']]
);