#xqprtzcv

1 messages · Page 1 of 1 (latest)

dusk glenBOT
rain shadow
#

You can use customer.subscription.updated for both since this event will be triggered when a subscription moves from trialing to active

#

You can also listen for customer.subscription.trial_will_end if you want to be alerted three days before a trial ends

sand geyser
#

Will I be able to see the change from trialing to active in a single webhook, or do I need to keep track on my end?

rain shadow
#

Not sure what you mean by that

sand geyser
#

I guess I meant to say single event

rain shadow
#

The event payload for customer.subscription.updated will include both a subscription object and a previous_attributes hash so you can see what changed

sand geyser
#

Great, thank you!

rain shadow
#

You can use these to create a test subscription and "advance" time to see status changes, new invoices, etc. related to changes to billing cycles

sand geyser
#

Am I seeing this correctly that customer.subscription.updated is not called when the subscription ends? I need to listen for customer.subscription.deleted as well?

rain shadow
#

If a customer opts to cancel at the end of the billing period, you should see customer.subscription.updated and customer.subscription.deleted

#

If a customer opts to cancel immediately, you will only see customer.subscription.deleted

sand geyser
#

Right now I am only seeing the customer.subscription.updated when I switch to 'cancel_at_period_end': True and then when I advance the test clock I only see customer.subscription.deleted (but not another customer.subscription.updated) at the end of the trial

rain shadow
#

Right, that makes sense

sand geyser
#

Ok, so if I want to do something when the trial ends (and subscription has been cancelled), then I need to keep track in my own database? Or is there a single webhook event that I can listen for to identify this situation?

rain shadow
#

you'll need to keep track of this yourself

sand geyser
#

OK, thank you

#

I guess I should be able to identify it listening to the customer.subscription.deleted and then seeing if data.object.cancel_at is equal to data.object.trial_end