how can i perform a function when a paid plan renews?

I would also like to run an event when someone’s Pricing Plan renews. For example, we want to send the client a discount code to use on apparel when their yearly club membership automatically renews.