#aleksandr_invoice-events

1 messages ยท Page 1 of 1 (latest)

vivid thornBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1234622778200690799

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

sage pawnBOT
manic siren
#

aleksandr_invoice-events

#

What exactly did you do to trigger this Event? payment_intent.payment_failed only happens after a payment attempt failed so if your Customer has no PaymentMethod saved for example there would be no real payment attempt and only invoice.payment_failed would be sent

silent oriole
#

I added test card 4000000000000341 (Decline after attaching) to subscription as payment method and wait for next billing cycle

manic siren
#

Did you make that card the defaut payment method for that Subscription or the Customer though?

silent oriole
#

I added this card to the Subscription

manic siren
#

I'm sorry this is super vague. Can I ask you to be a lot more explicit about exactly what you did with your code as a developer?

silent oriole
#

Sure. I have application that uses Stripe API. From my app I bought Subscription with valid card (4242) using Stripe checkout and session created in my app. After this successful first payment I changed card in Subscription from 4242 to 0341 in Stripe Dashboard. And I wait next billing cycle.

manic siren
#

After this successful first payment I changed card in Subscription from 4242 to 0341 in Stripe Dashboard.
is that specific PaymentMethod the default? I assume it's not and that's potentially your issue

silent oriole
#

In Subscription this is a default payment method, but in Customer - this PM also added, but not as default

vivid thornBOT
lilac niche
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

Give me a few minutes to get caught up.

#

Is there a reason not to listen for invoice.payment_failed in this case, since there will always be an invoice related to a subscription payment?

silent oriole
#

Listening for 'invoice.payment_failed" was my first implementation ๐Ÿ™‚ but, in this event there is no information about "what is wrong with payment"

#

In "invoice.payment_failed" there is a link to Payment Intent and I tried to fetch PI to get info about payment error, but sometimes PI is not updated to this moment and did not contains info about payment error

lilac niche
#

If you're fetching a PI that's related to an invoice.payment_failed Event, then I would expect the PI to have the latest up-to-date info. Are you saying that wasn't the case?

silent oriole
#

In some cases this PI does not contains "last_payment_error". I'm not sure, probably this is fine for up-to-date info.

lilac niche
#

That's liley expected, since not all invoice.payment_failed Events are generated from actual payment attempts (e.g. payments/authorizations that actually go out to the card issuer and receive a decline). Sometimes this will fail if there was no default payment method to charge at the invoice's due date.

silent oriole
#

So, how can I get an error code in this cases?

lilac niche
#

What error code?

silent oriole
#

last_payment_error

#

If something goes wrong with payment - where can I get details about it?

lilac niche
silent oriole
#

Okey, got it. Will try to implement. Thank you!