Regarding Atlassian Licensing API for Confluence Server

Is there any suggested approach as to how do we restrict the number of times we can allow a trial license to be used in our plugin? We need something like, allowing the customer to use trial license only n number of times for our plugin. If it exceeds n, we need to, in some way, gracefully let the customer know that he/she has already exceeded the limit for trial licenses.

At the moment I am trying to play around with the License Event listeners as explained here, to get the desired outcome, but no luck so far:

https://developer.atlassian.com/platform/marketplace/license-api-for-server-apps/

Please let me know if there are any other suggestions I can try out.