Thank You laszlof. I found the solution.
That was my original thought, to do processing in clientarea() code. But the function will get ridiculously long and defeat the purpose of having custom function ability. Plus, the code will lose it is modularity as well.
Here is easy solution. the WHMCS has smarty var for custom function output. Just put
{$modulecustombuttonresult} in clientareaproductdetails.tpl.
Credit to Matt in WHMCS