Jump to content

Hook ADD Funds


dbbrito

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated