dbbrito Posted January 3, 2021 Share Posted January 3, 2021 Friends, I have two payment portals on my whmcs! How can I make a hook so that in the ADD-Funds option it only shows one of the payment portals? Or would there be another way to do this? Thank you very much 0 Quote Link to comment Share on other sites More sharing options...
string Posted January 3, 2021 Share Posted January 3, 2021 WHMCS doesn't offer a native way to do this. You can do this using an hook. Save the following code into the file /includes/hooks/<a-readable-understandable-name>.php: <?php add_hook('ClientAreaPageAddFunds', 1, function($vars) { unset ($vars['gateways']['paypal']); return array("gateways" => $vars['gateways']); }); Just replace "paypal" with the name of the payment gateway. You must use the system name of the gateway, not the friendly name. To find out the system name, open the add funds page, look at the source code of the page via your browser and search for "paymentmethod". You will find a <select> tag where you can read the names. But you have to be aware that tech-savvy users could spoof the HTTP request by manually setting the value to the gateway's name. It is unlikely that this will happen, but if you want to be sure, you would have to cross-check the POST request as well. 0 Quote Link to comment Share on other sites More sharing options...
dbbrito Posted January 3, 2021 Author Share Posted January 3, 2021 1 hour ago, string said: WHMCS doesn't offer a native way to do this. You can do this using an hook. Save the following code into the file /includes/hooks/<a-readable-understandable-name>.php: <?php add_hook('ClientAreaPageAddFunds', 1, function($vars) { unset ($vars['gateways']['paypal']); return array("gateways" => $vars['gateways']); }); Just replace "paypal" with the name of the payment gateway. You must use the system name of the gateway, not the friendly name. To find out the system name, open the add funds page, look at the source code of the page via your browser and search for "paymentmethod". You will find a <select> tag where you can read the names. But you have to be aware that tech-savvy users could spoof the HTTP request by manually setting the value to the gateway's name. It is unlikely that this will happen, but if you want to be sure, you would have to cross-check the POST request as well. Thank you very much string, it worked perfectly. Happy 2021 !!! Thanks 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.