#bugkiller.
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ interesting, I'm not sure offhand if that is expected. Can you share the ID of the Subscription, and the ID of the Event that you received, so I can take a closer look at those?
I'm doing alright, hope you are as well! Thank you, I'm working on pulling that up.
Do you have a more recent example? The date of when that Event would have been generated is more than 30 days ago, so finding the related Event will be difficult due to the Event being outside of our retention period.
retention is 15 days?
hi toby
sub_1NTqGvBTGnRwDyDi0hiOrodE
this is also old to check?
Retention period is 30 days, the previous subscription's upcoming invoice event would have been sent on Aug 4. Taking a look at the second one.
Yes, that one is also too old, the invoice.upcoming Event for it would have been sent on July 18th.
we got that call on 2 days ago
Can you elaborate on what you mean by this? Are you saying you received an invoice.upcoming Event for that Subscription two days ago? If so, can you share that Event ID?
I'm not sure event id
we have logic to send upcoming invoice eamil inside webhook for 'invoice.upcoming' and it's fired 2 days ago
(that email is only used inside 'invoice.upcoming' webhook code. no any other places)
It's going to be hard for me to get a sense of what is going on without being able to see the Events that you're concerned about. What is making you think the Event is related to this Subscription that has been cancelled for more than a month? Is it something you're seeing in the Event body?
ok,
I've added some log into our webhook code so that I can bring more information to you when I get it again
one other question
if you don't mind
๐ stepping in here as toby needed to step away
๐
we're going to send an email to user if their subscription is canceled due to payment failure
how to archive this?
this is our retry setting
You would listen for customer.subscription.deleted
but I don't want to send an email if subscription is canceled by user
Then you want to check the latest Invoice on the Subscription and see if it has used up all of its attempst via looking at attempt_count
what should be that number it is based on oiur 'failed payments' setting
Sure
So yes... in that screenshot you have 1 retry set up
You can also test this out quite easily!
so what should be a number to check
attempt_count == ?
I don't know how to test it easily and quickly
You can test by using the test card that declines after attaching: https://stripe.com/docs/testing#declined-payments
That said, you would want attempt_count to be 2 in this case
That would mean there was an initial attempt and one retry
ok, so it means I need to implement webhook for the event customer.subscription.deleted and inside that event I'll try to check latest invoice's attempt count
if that attempt_count is 2 ( based on my payment retry setting), I can consider subscription is canceled due to payment retry failure
Am I correct?
Yep
how can I find whole request body for specific webhook
for example, what kind of data will be expected for webhook customer.subscription.deleted
It is the object that is associated with the Webhook.
what I can see in the doc is this
So see how that says is a subscription
That means it is a Subscription object
So the response includes that object: https://stripe.com/docs/api/subscriptions/object
makes sense
then I have subscription object, then I need to retrieve the latest invoice via stripe api for this specific subscription to check my goal right?
Correct, you can actually just re-retrieve the Subscription and expand the latest_invoice when you do that
Are you familiar with expansion?
If not, I'd take a look at https://stripe.com/docs/expand
Happy to help
Sure it will stay open for a bit
If it does get closed you can always just post again the main channel
hi
customer.subscription.deleted
in this webhook, subscription status will be always 'canceled' ?
am I correct?
Yes