It may perhaps we useful to have a way to disable current licence (under specific circumstances)
Further, we could improve the way how licence is deployed.
Both of the above may be possible to achieve by having a tool that generates licences in a form of a jar file (or an executable). This jar file can be shipped to a customer instead of a 'textual' description of the licence code.
Customer that may deploy this jar and it will have the licence key embedded in it. Thus allowing the application to be instantiated with a valid licence.
Further, we can have a jar file that would contain functionality to disable licence when a 'refund' licence is used or a new licence is provided when the previous one has not expired yet. The class inside the jar can do 'all the work' to check and verify the currently deployed licence on that application, compare it with it's server id and perform all necessary tasks to disabling it's use and substituting it with a new licence.