#chris_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/1286267819201134653
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, let me help you with this.
user has requested the subscription is cancelled
Do they do it via your app?
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
an API call
...made by your app?
Yeah
Then you can add the cancellation_details yourself and filter out based on that: https://docs.stripe.com/api/subscriptions/cancel#cancel_subscription-cancellation_details
But it would be helpful if you could share Subscription IDs for both examples
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
You can still update the cancellation details in this call: https://docs.stripe.com/api/subscriptions/update#update_subscription-cancellation_details
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)?
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?
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.
You can use Test clock to simulate failed payments quickly: https://docs.stripe.com/billing/testing/test-clocks
Thanks! Didn't know this was a thing, might be really useful!
Okay, no problem, I will try the test clock and compare the events
Happy to help.