#mounirmtl

1 messages ยท Page 1 of 1 (latest)

mental nicheBOT
#

Hello! We'll be with you shortly. 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.

solid thunder
#

Hi there ๐Ÿ‘‹ thank you for flagging this, that does look like a typo on our end.

Instead you'll want to make a request to update the Subscription, and set the cancel_at_period_end parameter to true when doing so:
https://stripe.com/docs/api/subscriptions/update#update_subscription-cancel_at_period_end

mental nicheBOT
cloud ice
#

Sorry for the late response..

Do we want to do that right before canceling? Or can we set this flag at subscription creation?

#

nevermind. I noticed we could do it at subscription creation

solid thunder
#

If you're going to cancel immediately, no there isn't a point to use that parameter, you'd instead make a request to immediately cancel the Subscription:
https://stripe.com/docs/api/subscriptions/cancel

Setting it at creation will cause the Subscription to only last one billing period. That isn't something I've seen most people want but should be available to you if that's the behavior you're after.

cloud ice
#

Oh I see. So if we want the subscription to continue until the end of the billing period, we just need to update the subscription with this flag and it will automatically be canceled at the end of the period?

solid thunder
#

Yup, it configures the Subscription to be cancelled at the end of the current billing period.

cloud ice
#

I see and when a subscription is canceled, the webhook that is hit is customer.subscription.deleted?

solid thunder
#

Exactly. And that won't be triggered when the Subscription is updated with cancel_at_period_end, it only triggers when the Subscription actually is cancelled.

cloud ice
#

Is there a way to know when a subscription has been canceled before it's been deleted?

#

should I check the flag on the updated webhook?

solid thunder
#

I don't understand the question, cancelling and deleting Subscriptions are the same thing in Stripe.

#

Oh oh, you want to know if the Subscription has been updated to be cancelled at the end of the current period?

cloud ice
#

yes

solid thunder
#

Gotcha! You're spot on then. You'll want to listen for customer.subscription.updated and check whether cancel_at_period_end has changed and if so what it is set to.

cloud ice
#

Does that mean I need to keep track of cancel_at_period_end for every updated event received to know if it has changed? Or can I assume that if it's set the subscription will be canceled

wooden spindle
#

๐Ÿ‘‹ hoppingin here since toby had to head out

solid thunder
#

Neither

cloud ice
#

๐Ÿ‘‹ Have a nice rest of the day toby

solid thunder
cloud ice
#

Oh awesome. Thank you

solid thunder
#

Any time! Alright, I'm actually stepping away this time, hope you have a great day as well! If there's anything else, please let karbi know. ๐Ÿ‘‹

cloud ice
#

๐Ÿ‘ Will do. Thank you for your time. Extremely appreciated

#

karbi, if cancel_at_period_end has been set to true, does that mean the cancel_at field will always be there?

#

and will always reflect when the susbcription will be canceled?

wooden spindle
#

Yes, if cancel_at_period_end is set to true, the cancel_at will also be set

cloud ice
#

can cancel_at_period_end be changed from true to false?

wooden spindle
#

Yup!

cloud ice
#

lol. So we can cancel a cancellation... That's becoming very meta ๐Ÿ˜…

#

Actually that's normal behavior. I've seen that in many subscription based product. That's just me being weird. Sorry ๐Ÿ™‚

wooden spindle
#

No worries! It's definitely a bit weird to wrap your head around - a lot of subscription flows like that make way more sense when you think of real world examples ๐Ÿ™‚

cloud ice
#

One more question,
For subscription boxes where there's some time required to fulfill an order from a subscription.
How can we configure stripe to notify us the next billing cycle has started? So we can internally create a new order to be fulfilled

wooden spindle
#

Usually you'd listen for customer.subscription.updated and check for whether current_period_start has changed to know whether a new cycle has started

cloud ice
#

Interesting...

#

That's amazing. Thank you