The WHMCS Gateway Limiter allows you to restrict the payment methods in the customer area to certain customer groups or characteristics. For example, you can block domestic payment methods if the customer is from abroad, or make certain payment methods available only to existing customers.
System requirements
To use and install the Gateway Limiter module, the following requirements must be met:
- Running WHMCS Installation Version 8.8 – 8.11
- Admin access to WHMCS
- FTP access
- installed Ioncube Loader (at least version 13)
- PHP 7.4, 8.1 & 8.2
Installation
- Please log in to the Plambee.de web hosting customer area and download the latest version of Gateway Limiter there.
- Unpack the zip.file on your computer.
- upload the modules and templates folders via FTP to your WHMCS directory.
- Now log in to your WHMCS admin area.
- In the addon list please search for the module Gateway Limiter and click on “Activate” and then on “Configure”.
- In the field “Module license” please enter your license code, you can find it in the Plambee.de customer area in the product details.
- Next you can configure the respective gateways in the module.
- Next, a few template adjustments are necessary:
Open the masspay.tpl of your Templates and replace:
{foreach from=$gateways item=gateway}
<option value="{$gateway.sysname}">{$gateway.name}</option>
{/foreach}
with
{foreach from=$gateways item=gateway}
{if $total->toNumeric() >= $gateway.min && $total->toNumeric() <= $gateway.max}
<option value="{$gateway.sysname}">{$gateway.name}</option>
{/if}
{/foreach}
Please open the clientareaaddfunds.tpl of your template and paste the following code above:
<script>
function gateway_limiter() {
var amount = $('#amount').val();
{foreach from=$gateway item=gateway}
if ( (amount < {$gateway.min}) || (amount > {$gateway.max}) ) {
$("#paymentmethod option[value={$gateway.sysname}]").remove();
}
if ( (amount >= {$gateway.min}) && (amount <= {$gateway.max}) ) {
if ( $("#paymentmethod option[value={$gateway.sysname}]").length == 0 ){
$('#paymentmethod').append($('<option>', {
value: '{$gateway.sysname}',
text: '{$gateway.name}'
}));
}} {/foreach}
}
</script>
<body onload="gateway_limiter()">
then replace
<input type="text" name="amount" id="amount" value="{$amount}" class="formcontrol"
required />
by
<input type="text" name="amount" id="amount" value="{$amount}" class="formcontrol"
required onkeyup="gateway_limiter()"/>
Open the upgradesummary.tpl and replace
{foreach key=num item=gateway from=$gateways}
<option value="{$gateway.sysname}"{if $gateway.sysname eq $selectedgateway}
selected="selected"{/if}>{$gateway.name}</option>
{/foreach}
with
{foreach key=num item=gateway from=$gateways}
{if $total->toNumeric() >= $gateway.min && $total->toNumeric() <= $gateway.max}
<option value="{$gateway.sysname}"{if $gateway.sysname eq $selectedgateway}
selected="selected"{/if}>{$gateway.name}</option>
{/if}
{/foreach}
If you don’t have any language files in the WHMCS directory /lang/overrides/ yet, please take the files on the zip directory of the module and rename the english.php_temp to english.php and the german.php_temp to german.php. If you already have language files in the overrides directory, please open the german.php_temp and copy the contained language strings into your german.php. Repeat this for the english.php_temp.
With these steps the installation is complete. No further customization in the cart is necessary, here the module uses a WHMCS own hook whereby the customer gets a message when trying to place the order with a not allowed payment option (like if he doesn’t store a password).
Update notes
Update to Version 1.5.0
In version 1.5.0, the amount check has been extended to include top-up, upgrade and bulk payment. However, the following template adjustments are necessary for this. Please open the clientareaaddfunds.tpl of your template and insert the following code above:
<script>
function gateway_limiter() {
var amount = $('#amount').val();
{foreach from=$gateways item=gateway}
if ( (amount < {$gateway.min}) || (amount > {$gateway.max}) ) {
$("#paymentmethod option[value={$gateway.sysname}]").remove();
}
if ( (amount >= {$gateway.min}) && (amount <= {$gateway.max}) ) {
if ( $("#paymentmethod option[value={$gateway.sysname}]").length == 0 ){
$('#paymentmethod').append($('<option>', {
value: '{$gateway.sysname}',
text: '{$gateway.name}'
}));
}}
{/foreach}
}
</script>
<body onload="gateway_limiter()">
then replace
<input type="text" name="amount" id="amount" value="{$amount}" class="formcontrol"
required />
by
<input type="text" name="amount" id="amount" value="{$amount}" class="formcontrol"
required onkeyup="gateway_limiter()"/>
Then open the masspay.tpl and replace
{foreach from=$gateways item=gateway}
<option value="{$gateway.sysname}">{$gateway.name}</option>
{/foreach}
by
{foreach from=$gateways item=gateway}
{if $total->toNumeric() >= $gateway.min && $total->toNumeric() <= $gateway.max}
<option value="{$gateway.sysname}">{$gateway.name}</option>
{/if}
{/foreach}
Open the upgradesummary.tpl and replace
{foreach key=num item=gateway from=$gateways}
<option value="{$gateway.sysname}"{if $gateway.sysname eq $selectedgateway}
selected="selected"{/if}>{$gateway.name}</option>
{/foreach}
by
{foreach key=num item=gateway from=$gateways}
{if $total->toNumeric() >= $gateway.min && $total->toNumeric() <= $gateway.max}
<option value="{$gateway.sysname}"{if $gateway.sysname eq $selectedgateway}
selected="selected"{/if}>{$gateway.name}</option>
{/if}
{/foreach}
Update to Version 1.12.0
Due to an unfixed bug in the Stripe Gateway of WHMCS, we need to outsource the error messages that are displayed to the customer in the checkout to the WHMCS own language files.
If you don’t have any language files in the WHMCS directory /lang/overrides/ yet, please take the files on the zip directory of the module and rename the english.php_temp to english.php and the german.php_temp to german.php.
If you already have language files in the overrides directory, please open the german.php_temp and copy the contained language strings into your german.php. Repeat this for the english.php_temp.
This is necessary even if you do not use the Stripe Gateway.
Notes
In the current version, the module only hides the payment options in the customer area. If you have made a payment option inaccessible for a customer, for example, please check the payment settings in the respective customer profile and change them manually if necessary, if the payment method made inaccessible is used here.
If you have tested our module with the trial version, please remember to either buy a new license in time before the trial license expires or to restore your templates to their original state. Otherwise, your customers will no longer see a payment option in the customer area.
If you deactivate or add a gateway in WHMCS, please go to the module afterwards so that the module can import the new information.