#eoghanobrien

1 messages · Page 1 of 1 (latest)

jade trenchBOT
pastel brook
#

You can check the previous_attributes hash on the event to see what on the subscription has changed. If the user cancels their subscription you will see canceled_at: null in the previous attributes hash and canceled_at: {SOME_TIME_STAMP} on the actual subscription object in the event that shows when the subscription will actually cancel

#

Not 100% sure what you mean by renew here. Are you talking about them setting the subscription to cancel at some point and then uncanceling the subscription? Or something else?

hollow tusk
#

yeah, that's how the billing portal does it

#

good call on the previous_attributes hash, I wasn't sure how reliable they were

pastel brook
#

Gotcha. Yeah that property is reliable, you will definitely get an event that shows this change when a user does something to their subscription in the customer portal

hollow tusk
#

Great! Thank you! We won't get a subscription.status = 'canceled' unless the payment is also "canceled"/refunded/failed - is that correct? Or said more clearly, when do we get subscription.status = 'canceled'?

pastel brook
#

It sounds like you have your customer portal set to cancel these subscriptions at the end of their current period. So, when they would normally renew they will instead cancel. The canceled_at timestamp will give an exact time for this

hollow tusk
#

Yeah, the whole cancel_at_period_end thing

#

I would change that to immediately in order to have it change the status to canceled?

pastel brook
#

Yes, in that case the subscription would immediate cancel when the user clicks submit on the customer portal

#

And you will get a customer.subscription.deleted event right away

#

Oh and for the cancel_at_period_end flow you will also get a customer.subscription.deleted event when the subscription actually ends

jade trenchBOT
hollow tusk
#

Looks like we missed some webhooks because of our misunderstanding of how to handle cancel/uncancel via the Billing portal. Is there a way to look up how many customers have canceled via the billing portal?

#

or renewed

forest aspen
#

Not that I'm aware of, no

hollow tusk
#

Could I look up all subscriptions and filter by customer ids

forest aspen
#

Yeah, that's definitely possible either via the Dashboard or the API

hollow tusk
#

Can I filter by 340 customer IDs?