#aksharj-invoice-charge

1 messages · Page 1 of 1 (latest)

cyan steeple
mental shard
#

hi @cyan steeple i am doing some processing on receiving webhooks for above events

#

and want to know if there can be a scenario where invoice.paid is success but charge.succeeded errors out

cyan steeple
#

I don't believe that's possible - the only strange edge case I can think of is invoice's that don't need any payment at all (when they're for $0) will automatically succeed and not have any charge.succeeded event at all

#

but I don't think you'd get invoice.paid and charge.failed

mental shard
#

awesome, many thanks.

#

just one more follow up question then, how can i find the subscription from a charge object?

#

do i have to make a separate call to retrieve the invoice from the charge and see for what subscription it is?

cyan steeple
#

When you retrieve the charge you can expand (see https://stripe.com/docs/expand) payment_intent.invoice.subscription to get back all three of those objects expanded in a single retrieve call

mental shard
#

i am doing the processing in webhooks, not sure how i can expand the charge object there

cyan steeple
#

You would re-retrieve the charge object that you get back from the webhook event

mental shard
#

ah ok, thanks for this 👍