Jump to content
Sign in to follow this  

Force Payment Gatewat depending on Invoice Balance

Recommended Posts

It doesn't matter what payment method you use. It can be PayPal, Stripe, Skrill or Credit Card. The typical gateway charges absurdly high fees to manage your money. Billing Extension helps you saving up to 18% on transaction fees but such costs can be lowered even further.

Let's face it. In an ideal world we would be receiving money just with Bank Transfer (aka Wire Transfer) since it doesn't cost you anything. The following hook can be used to force the most convenient gateway you have depending on invoice balance. For example if invoice balance >= 1000 euro force banktransfer. Let's do some math.

  • PayPal charges 3.4% + 0.35 € per transaction meaning that receiving 1000 € costs you 35.35 €
  • Let's suppose on a yearly basis you receive 10 payments of 1000 €
  • At the end of the year you gave to PayPal 353.5 €

With this hook you can keep this money for you. As if it wasn't enough, the hook can be customized to force the payment gateway depending on customers' country. For example you can use the hook just for specific countries (eg. IT, FR, DE) and/or European Union. Don't worry about multiple currencies. The script automatically handles currency conversion when needed.

Get the Code »

Share this post

Link to post
Share on other sites


It is worth to say that the hook allows administrators to lift restrictions on specific invoices. All you all you need is changing the payment method from Options tab (Invoice View). This will add the following note Payment Method Unlocked by Administratror that serves as a way to let customers freely choose their gateway.

Of course we don't want such note to be visible in front-end hence the hook automatically removes it from the HTML version invoices. As for the PDF version, you'll need to place a small piece of code right above if ($notes) statement in your invoicepdf.tpl as follows:

# Notes
$notes = str_replace('Payment Method Unlocked by Administratror', '', $notes);
$notes = ($notes ? $notes : false);
if ($notes) {
    $pdf->SetFont($pdfFont, '', 8);
    $pdf->MultiCell(170, 5, Lang::trans('invoicesnotes') . ': ' . $notes);


Share this post

Link to post
Share on other sites
On 18.08.2020 at 14:03, Kian said:

Nu contează ce metodă de plată utilizați. Poate fi PayPal, Stripe, Skrill sau Card de credit. Gateway-ul tipic percepe taxe absurd de mari pentru a vă gestiona banii. Extinderea facturării vă ajută să economisiți până la 18% din taxele de tranzacție, dar astfel de costuri pot fi reduse și mai mult.

Hai sa recunoastem. Într-o lume ideală, am primi bani doar prin Transfer bancar (aka Transfer bancar), deoarece nu vă costă nimic. Următorul cârlig poate fi utilizat pentru a forța cel mai convenabil gateway pe care îl aveți în funcție de soldul facturii. De exemplu, dacă soldul facturii> = 1000 euro forțează transferul bancar . Hai să facem niște calcule.

  • PayPal percepe 3,4% + 0,35 € per tranzacție, ceea ce înseamnă că primirea a 1000 € vă costă 35,35 €
  • Să presupunem că, anual, primiți 10 plăți de 1000 €
  • La sfârșitul anului ați dat PayPal 353,5 €

Cu acest cârlig puteți păstra acești bani pentru dvs. Ca și cum nu ar fi suficient, cârligul poate fi personalizat pentru a forța gateway-ul de plată în funcție de țara clienților. De exemplu, puteți utiliza cârligul doar pentru anumite țări (de exemplu, IT, FR, DE) și / sau Uniunea Europeană. Nu vă faceți griji cu privire la mai multe valute. Scriptul gestionează automat conversia valutară atunci când este necesar.

Obțineți codul »


where and how and in what folder or how to add these codes I put the code in invoicepdf.tpl but there is no change that must be done exactly step by step

Share this post

Link to post
Share on other sites
1 hour ago, Kian said:

Descărcați scriptul și încărcați-l în directorul include / hooks .


which script when I download there are several folders I really don't understand how to proceed can you tell me exactly each step? or what I need to put in the hooks directory

Share this post

Link to post
Share on other sites

You can find all details about action hooks here. Here's a step-by-step guide:

  1. Go here and click File > Save page as...
  2. Your browser will download a file named ForcePaymentGatewayDependingOnInvoiceBalance.php
  3. Use an FTP client to upload this file in includes/hooks directory
  4. Edit the file you have just uploaded with a text editor
  5. Configure it according to your needs, save, upload and confirm you want to overwrite

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Similar Content

    • By Kian
      Restrict the access to support departments based on the products purchased by users. Define rules as follows.
      $department['1'] = array('45', '46', '10'); $department['2'] = array('85', '86', '10'); // Keep adding rules one per line The key of $department array (the [1] and [2] between square brackets) corresponds to the ID of the support department for which we are creating a rule. The value is an array() of product IDs required for access. In a in nutshell, the above configuration unlocks department #1 to users with product IDs 45, 46 and 10. Department #2 requires 85, 86 and 10.
      Here are few more things to consider:
      submitticket.php doesn't show restricted departments Access via direct link submitticket.php?step=2&deptid=2 triggers a redirect to submitticket.php Department dropdown lists only allowed department The same product can be used for multiple rules Pending, Suspended, Terminated, Cancelled and Fraud products are ignored Get the Code »
    • By hamza.cb
      We are using WHMCS for billing our customers. Our customers are reporting us an issue related to payment through credit card(stripe) without registering.
      An error occurred of an invalid date. 
      BUT when they register and we send them a custom invoice, then the same credit card is working for them.

    • By Kian
      Client group background colors no longer display on ticket view page. Go figure out why WHMCS decided to remove it from v8. This action hook puts the styling back.

      Get the Code »
    • By Kian
      As you probably know WHMCS v8 no longer provides statistics on top of the page about pending orders, overdue invoices and tickets awaiting reply. This action hook adds them back to interface as you can see from the following screenshot.

      This badge is fully responsive and appears if there's at least one pending order, overdue invoice or ticket awaiting reply. If there's nothing to show it disappears. To avoid any possibility of confusion, the hook automatically detects if you're running v8.
      Get the Code »
    • By AhmedmZaki
      i want to integrate new third party method i fowled the documentation and the payment is redirect back to the success link but the invoice id is always zero knet.php 

  • 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