#cnguyen85

1 messages · Page 1 of 1 (latest)

burnt breachBOT
mighty moon
#

Hi there!

#
  • To know when a subscription is deleted: customer.subscription.deleted
  • To know if a subscription will be canceled in the future: customer.subscription.updated, and check the cancel_at property
#
  • To know if a Subscription is in a trial, check it's status
azure briar
#

If we cancel the subscription at the end of the cycle (cancel_at), we will have a customer.subscription.deleted at this moment, no ?

#

And for the end of trial, I check customer.subscription.updated and I have to check if the updated attribute is status ? And if the status was trial and the new one is active ?

mighty moon
#

If we cancel the subscription at the end of the cycle (cancel_at), we will have a customer.subscription.deleted at this moment, no ?
No

#

You will get a customer.subscription.updated event

#

And the cancel_at property should be set.

azure briar
#

ok so, to do some stuff when a user cancel a subscription, there is 2 things to check :

  • Subscription canceled is stoppped directly => customer.subscription.deleted
  • Subscription is canceled but at the end of the cycle => customer.subscription.updated

On the 2nd usecase, I have to check if the updated attributes is cancel_at. Right ?

mighty moon
#

That's correct

azure briar
#

OK. And the best way is always to check the updated attributes, correct ?

warm quartz
#

Hi 👋 jumping in as my teammate needed to step away. Yes, checking the details provided in previous_attributes is a good way to review what changes an Event is informing you about.

azure briar
#

ok

#

So, to check a end of trial, I listen the customer.subscription.updated webhook. And I have to check if the current status is active and the previous_attributes.status is trial ?

warm quartz
#

Yup

azure briar
#

ty

#

and there is an event when the cancel_at is today ?

#

or what is the event when it's the end of the subscription

warm quartz
azure briar
#

ssok so I just have to handle deleted. It's because it was not the answer from soma

#

got it

warm quartz
#

Sorry, maybe I'm missing a nuance that you're including, because they pointed you to that Event in their first message.

warm quartz
azure briar
#

I want to know when a subscription is canceled or over to cancel an access to a BO

#

FOr me, I just have to remove the BO access on the subscription.deleted so ?