#chris_webhooks

1 messages ¡ Page 1 of 1 (latest)

chilly jewelBOT
#

👋 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/1286267819201134653

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

ancient pine
#

Hi, let me help you with this.

#

user has requested the subscription is cancelled
Do they do it via your app?

dusk pecan
#

No, it will be an API call. I can send you an event that is triggered if that helps?

#

Although, if its triggered via the Stripe dashboard, or manually by the user with an API, I don't think that'd be an issue. I'm mainly interested in filtering out the automatic processes

ancient pine
#

an API call
...made by your app?

dusk pecan
#

Yeah

ancient pine
#

But it would be helpful if you could share Subscription IDs for both examples

dusk pecan
#

At the moment, the process is using Subscription::update, which is something I can't really change. It is setting cancel_at_period_end to true and releasing a schedule. (It persists the schedule as metadata incase the user tries to undo the action)

#

But it would be helpful if you could share Subscription IDs for both examples
sub_1Q0JF9HZLNwo79RqZ3AJT275

ancient pine
dusk pecan
#

Okay, looks like it is already updating the reason to "cancellation_requested". So I can confidently look for if this reason is set and when customer.subscription.deleted is fired I can look for this exact string? Or can I just check if its unset (if stripe has cancelled it via an internal process)?

ancient pine
#

stripe has cancelled it via an internal process
Do you have an example of that?

dusk pecan
#

Hmm, I might be able to find one, but it wont be in test mode and could take me a while

#

Unless I can use the CLI to generate one with fixtures?

ancient pine
#

I can say, there's no specific parameter that distinguishes an automatic cancellation. I suggest you to look through the data and see what cancelation_details do the automatically cancelled Subscriptions have.

dusk pecan
#

Okay, no problem, I will try the test clock and compare the events

ancient pine
#

Happy to help.