There isn't currently a model like this. You pay when you purchase a license, whether it is used or not.
One option in your case though would be to detect inactive users via Microsoft Graph or script and remove the users and licenses that you do not need.
See also: Get inactive users with licenses assigned
If the information was helpful to you, please Accept the answer. This will help us as well as others in the community who may be researching similar questions.