#aabhaskarma_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ 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/1300672220401635399
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- aabhaskarma_subscription-status, 11 hours ago, 11 messages
hello! Gimme a while to look into this
OK. Thanks ๐
Hi @white shuttle this behaivour is explained in the first sentence
In evt_1QEgQEF8tiMhHfPbdOQPfGZy, the invoice in_1Q1GkXF8tiMhHfPbiD0EutNu became uncollectible, and that's why voiding it (evt_1QEgQGF8tiMhHfPbr9PDlwwz) changed the subscription to active.
But when stripe marked uncollectible invoice in this event: evt_1QEuiQF8tiMhHfPbRGMHeXV0
The subscription was deleted in this event right after: evt_1QEuiXF8tiMhHfPbuoeuZz8C
These events are from test customer: cus_R78wyNile0ReSg
No, the subscription wasn't deleted yet when you voided the invoice at 2024-10-28 00:03:03 UTC, it was deleted later at 2024-10-29 01:27:35
customer.subscription.deleted triggered right after invoice.marked_uncollectible
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
This one is a different test customer.
Are we talking about a different subscription? the subscription that I am referring to is sub_1NUjX7F8tiMhHfPbX308pmfw
Yes
I am talking about sub_1QEuejF8tiMhHfPbluMuxyOk
sub_1QEuejF8tiMhHfPbluMuxyOk subscription behaving as I expected but not sub_1NUjX7F8tiMhHfPbX308pmfw
I thought I just explained the behaviour of sub_1NUjX7F8tiMhHfPbX308pmfw ?
If the invoice is in a paid or uncollectible state, the subscription state is set to active.
But for subscription sub_1QEuejF8tiMhHfPbluMuxyOk, the customer.subscription.deleted triggered right after invoice.marked_uncollectible
What's the event ID of the customer.subscription.deleted ?
evt_1QEuiXF8tiMhHfPbuoeuZz8C
That's a different subscription, i.e., sub_1QEuejF8tiMhHfPbluMuxyOk
right
I was expecting the same behaviour in both of the customers/subscriptions I mentioned abaove
ie subscription cancelled
They are different, because you cancelled sub_1QEuejF8tiMhHfPbluMuxyOk before voiding its latest invoice.
I am not sure which event cancelled it beside evt_1QEuiXF8tiMhHfPbuoeuZz8C
I found evt_1QEuh9F8tiMhHfPbE8LeDXg4 event that updated active to past_due, before event evt_1QEuiXF8tiMhHfPbuoeuZz8C
The subscription was cancelled automatically due to payment failure, as indicated in its cancellation_details
"collection_method": "send_invoice" is in both cases so the payment should be failed for sub_1NUjX7F8tiMhHfPbX308pmfw as well
Is there any update_details?
I did similar steps in https://dashboard.stripe.com/test/customers/cus_R7NYWYqZwPuWWH, the subscription got cancelled automatically.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
evt_1QF8sWF8tiMhHfPbGixtOZD6
Let's take a step back, can you tell me what problem that you want to resolve here?
We have multiple customers with "collection_method": "send_invoice" where payments are made outside Stripe.
We set "days_until_due": 7 when creating the subscription. After 37 days (7 + 30), Stripe marks it as "uncollectible," triggering the invoice.marked_uncollectible webhook. This webhook activates our function that voids the invoice.
We expected subscriptions to auto-cancel next year if no payment is made outside Stripe, but the subscription remains active. The invoice is marked uncollectible and voided.
The test customers scenarios I mentioned above behave as expected, but an issue occurred with event evt_1QEgQGF8tiMhHfPbi6sNVyvp. The subscripition is active instead of cancelled.
To clarify, so you want to void the uncollectible invoice to make subscription state to active?
I want to cancelled the subscription of uncollectibale and voided invoice
Expecting common behaviour between production and test customer
Then you shouldn't void the uncollectible invoices. As I explained in the very begining
If the invoice is in a paid or uncollectible state, the subscription state is set to active.
Yes, I understand this. But do understand behaviour of cus_R78wyNile0ReSg and cus_R7NYWYqZwPuWWH customers
Are you still talking about sub_1QEuejF8tiMhHfPbluMuxyOk and sub_1NUjX7F8tiMhHfPbX308pmfw ?
As those are "collection_method": "send_invoice" and "days_until_due": 7 so the payment will 100% failed
yeas
Yes
Ok, let me do it again.
We are missing something because of which they behaving differently
First of all, sub_1QEuejF8tiMhHfPbluMuxyOk has a test clock, and that's why you can advance the time and let the subscription to be cancelled (at 2024-10-28 15:18:53 UTC) automatically due to payment failure.
At 2024-10-28 15:18:55, you made a reqeust to void its latest invoice.
Yes we made the void request after we got invoice.marked_uncollectible event from webhook
Ok. Any other quetion about this subscription before we move to the next one?
Same for sub_1QEuejF8tiMhHfPbluMuxyOk, but using test clock
Ok, if you have no more question let's talk about sub_1NUjX7F8tiMhHfPbX308pmfw
As sub_1QEuejF8tiMhHfPbluMuxyOk is working as expected, subsciption got cancelled due to payment failed, so no question for it
For sub_1NUjX7F8tiMhHfPbX308pmfw, payment should failed too and subsciption should get cancel
But we cancelled it manually this morning, we want it to be automatic
sub_1NUjX7F8tiMhHfPbX308pmfw doesn't have a test clock, so you have no way to advance it.
Now, the subscription is to be cancelled automatically (based on your invoice settings), but because you explicitly voided the invoice, this made the subscription became active.
To solve this problem, you just don't void the uncollectible invoices.
sub_1QEuejF8tiMhHfPbluMuxyOk have same scenarios and we are voiding it as well and the subscription got auto cancelled. ๐
Why there is different in sub_1NUjX7F8tiMhHfPbX308pmfw?
The test clock made the subscription cancelled before your void inovice request.
Is this some kind of race condition or something?
Sort of. But in any case you shouldn't void the invoice if you don't intent to change the subscription state to active.
I will look into it. If I find anything, I will open a new thread for it.
Thanks for the help. ๐