#a__.
1 messages · Page 1 of 1 (latest)
Hi there, what's the event ID?
I don't really have a specific event id, I just want to know whether it's possible I get the event with this :
case 'customer.subscription.deleted': {
const subscription = event.data.object as Stripe.Subscription;
...
customer.subscription.deleted is the webhook triggered
I looked at this but didn't find anything telling how to know if it was cancelled automatically or not : https://stripe.com/docs/billing/subscriptions/overview#subscription-lifecycle
I don't quite understand your question, are you asking if the event data in 'customer.subscription.deleted' is of type subscription ?
Ok so when a user cancels a subscription, I update it so the cancel_at_period_end = true. So the subscription will end at the end of the subscription period.
I wanted to know if the deletion of the subscription was triggered automatically at the end of the period or with a cancel call
Just to be clear, https://stripe.com/docs/api/subscriptions/cancel#cancel_subscription are you using this API to cancel the subscription?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
For the manual call yes
The manual cancel call is triggered when a user doesn't start the subscription. They just went to checkout but didn't complete the checkout.
If you use that API to cancel the susbcription, the susbcription would be cancelled immediately.
Yeah I know but the thing is I am using webhook events
If I use the API it would also trigger customer.subscription.deleted event
I wanted to know how can I differentiate between an API cancel and a Stripe triggered cancel at the end of subscription period
I hope it's clear
Let me rephrase the question, so you want to know if the subscription is cancelled at peroid end, or cancelled by the cancellation API call?
Yes exactly
Ok, then just check https://stripe.com/docs/api/subscriptions/object#subscription_object-cancel_at_period_end
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So the value should still be true after deletion?
If you call the cancellation API to cancel the subscription, the cancel_at_peroid_end would be false.