Canceling stripe subscription

I figured it out.
However, I am struggling to figure out how to update true/false “subscription” status when users cancel the stripe subscription. I know that there are already many thread about this. Like this.

However, I don’t know about API at all, and I don’t understand it. Could you explain how to do it step by step? or any tutorials to help me understand it?