It would be great to consider several options.
One of the alternative solutions could be an application that complements the Downloads IPS application, which in the database allows users to place ads with files and get paid for them, obviously, with some customization, can become a universal solution for placing ads. This application could look like an extension / addition to the functions of the Downloads application. Details can be discussed with a positive response from developer.
Perhaps this way is easier, faster, less labor-intensive and probably more secure for user data using the downloads database?
@Adriano Faria , you have already created several useful customizations for Download application. What do you say, could you continue the set?