#joshualaba

1 messages · Page 1 of 1 (latest)

bright karmaBOT
near karma
#

What's the issue?

timid sierra
#

hey, just wanted to check when I have a stripe subscription plan which bills my users every month, on the billing date each month a stripe invoice object will be generated correct?

near karma
timid sierra
#

is it right to say as well, when the invoice object is created. Payment can only be attempted if the invoice is in 'OPEN' status. Payment can NEVER be attempted. when the status is 'DRAFT'?

near karma
#

Correct yes, as explained above

#

We finalise automatically after ~1 hour and attempt payment

timid sierra
#

ok so only after finalizing(open status), then stripe will attempt payment

#

what if payment fails

#

do I get a charge.failed or invoice.payment_failed event?

near karma
#

Yep! invoice.payment_failed. All of this is explained at the URL I shared

timid sierra
#

yeah thats what I thought as well

#

but im currently not processing the failed charges as desired. Although im doing exactly as what is discussed here. And shown in the link u shared..

near karma
#

Not sure what 'as desired' is. Specific example?

timid sierra
#

appreciate your time in helping, give me a moment to share the example

#

Im receiving stripe events in the webhook, specifically i check for event.type === 'invoice.payment_failed' subsequently, I also check for event.data.object.status === 'open'.
Then i check for event.data.object.attempt_count = 1 or 2. And then subsequently do something.
Following this logic, I am doing everything right to proceed to do something, when the payment attempt fails for the first time and the 2nd time right?

near karma
#

Well is it working as you expect? Have you tested it?

timid sierra
#

yeah i tried it, not being able to process the 1st and 2nd failed charges

#

but evertything seems sound as I described right?