#aabhaskarma_webhooks

1 messages ยท Page 1 of 1 (latest)

rich radishBOT
#

๐Ÿ‘‹ 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.

radiant saffron
#

hello! Gimme a while to look into this

white shuttle
#

OK. Thanks ๐Ÿ™‚

shy saffron
#

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.

white shuttle
#

But when stripe marked uncollectible invoice in this event: evt_1QEuiQF8tiMhHfPbRGMHeXV0
The subscription was deleted in this event right after: evt_1QEuiXF8tiMhHfPbuoeuZz8C

white shuttle
shy saffron
#

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

white shuttle
#

customer.subscription.deleted triggered right after invoice.marked_uncollectible

white shuttle
#

This one is a different test customer.

shy saffron
#

Are we talking about a different subscription? the subscription that I am referring to is sub_1NUjX7F8tiMhHfPbX308pmfw

white shuttle
#

Yes

#

I am talking about sub_1QEuejF8tiMhHfPbluMuxyOk

#

sub_1QEuejF8tiMhHfPbluMuxyOk subscription behaving as I expected but not sub_1NUjX7F8tiMhHfPbX308pmfw

shy saffron
#

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.

white shuttle
#

But for subscription sub_1QEuejF8tiMhHfPbluMuxyOk, the customer.subscription.deleted triggered right after invoice.marked_uncollectible

shy saffron
#

What's the event ID of the customer.subscription.deleted ?

white shuttle
#

evt_1QEuiXF8tiMhHfPbuoeuZz8C

shy saffron
#

That's a different subscription, i.e., sub_1QEuejF8tiMhHfPbluMuxyOk

white shuttle
#

right

#

I was expecting the same behaviour in both of the customers/subscriptions I mentioned abaove

#

ie subscription cancelled

shy saffron
#

They are different, because you cancelled sub_1QEuejF8tiMhHfPbluMuxyOk before voiding its latest invoice.

white shuttle
#

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

shy saffron
#

The subscription was cancelled automatically due to payment failure, as indicated in its cancellation_details

white shuttle
#

"collection_method": "send_invoice" is in both cases so the payment should be failed for sub_1NUjX7F8tiMhHfPbX308pmfw as well

#

Is there any update_details?

shy saffron
#

Let's take a step back, can you tell me what problem that you want to resolve here?

white shuttle
#

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.

shy saffron
#

To clarify, so you want to void the uncollectible invoice to make subscription state to active?

white shuttle
#

I want to cancelled the subscription of uncollectibale and voided invoice

#

Expecting common behaviour between production and test customer

shy saffron
#

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.

white shuttle
#

Yes, I understand this. But do understand behaviour of cus_R78wyNile0ReSg and cus_R7NYWYqZwPuWWH customers

shy saffron
#

Are you still talking about sub_1QEuejF8tiMhHfPbluMuxyOk and sub_1NUjX7F8tiMhHfPbX308pmfw ?

white shuttle
#

As those are "collection_method": "send_invoice" and "days_until_due": 7 so the payment will 100% failed

#

yeas

#

Yes

shy saffron
#

Ok, let me do it again.

white shuttle
#

We are missing something because of which they behaving differently

shy saffron
#

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.

white shuttle
#

Yes we made the void request after we got invoice.marked_uncollectible event from webhook

shy saffron
#

Ok. Any other quetion about this subscription before we move to the next one?

white shuttle
#

Same for sub_1QEuejF8tiMhHfPbluMuxyOk, but using test clock

shy saffron
#

Ok, if you have no more question let's talk about sub_1NUjX7F8tiMhHfPbX308pmfw

white shuttle
#

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

shy saffron
#

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.

white shuttle
#

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?

shy saffron
#

The test clock made the subscription cancelled before your void inovice request.

white shuttle
#

Is this some kind of race condition or something?

shy saffron
#

Sort of. But in any case you shouldn't void the invoice if you don't intent to change the subscription state to active.

white shuttle
#

I will look into it. If I find anything, I will open a new thread for it.
Thanks for the help. ๐Ÿ™‚