Hello!
In my code, can I distinguish between the following cases?
1) Regular trial expired
2) Trial extension expired
3) License expired
1) Regular trial expired
2) Trial extension expired
You can't differentiate these 2 by-design.
3) License expired
Just follow the example. If the customer is activated and genuine (follow the example article and example code) the you can check a custom license field to check for expiration.