b0VIM 9.1 Xg glen Glens-MacBook-Air-2.local ~glen/code/extensionpay/ExtPay/docs/how_subscriptions_work.md utf-8 3210 #"! U tp 2 H ad D C / - & % O N l k 8 7 a ` _ ^ F E k j W V P & % \ : p o } else if (user.subscriptionStatus === 'canceled') { console.log("Your subscription will cancel soon.") } else if (user.subscriptionCancelAt && user.subscriptionCancelAt < new Date()) { extpay.openPaymentPage(); console.log("You need to update your card!"); } else if (user.subscriptionStatus === 'past_due') { console.log("You're paid!") if (user.paid) { extpay.getUser().then(user => { const extpay = ExtPay('my-extension-id'); ```js Below is example code that handles all the states a user's subscription can enter. ### Example code that handles all subscription states Users who have canceled subscriptions cannot restart their subscriptions. They will have to create a new subscription by paying again. At the end of their billing cycle, `user.subscriptionStatus` will automatically switch to **`canceled`** and `user.paid` will be `false`. `user.subscriptionCancelAt` won't change. However, **`user.subscriptionCancelAt`** is populated with the datetime their subscription will expire. When a user cancels their subscription, it isn't canceled right away. Instead, `user.subscriptionStatus` remains `active` (and `user.paid` is `true`) through the end of the billing cycle. ### When a user cancels
