I want to automatically retrieve and sell licenses via PBAS. How do I achieve that?
You need to configure a Key Administrator plug-in with one or more license classes available for sale and offer them in the frame of the hosting plan.
For instance, point 8 of the following PBAS Provider's Guide chapter describes licenses configuration in Virtuozzo Container Hosting Plans:
In general the subject is covered by the following PBAS Provider's Guide chapter: