Jump to content
Kian

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

Updated.

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->Ln(5);
    $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

 

I don't know what I'm not doing well because it still takes my paypal commission per transaction I don't know what I didn't do well

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

  • Similar Content

    • 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 

      knet.php
    • By AhmedmZaki
      i'm try to add new payment method "third party " it's ok i added to thw whmcs also the payment is redirected to the payment portal but when it's come back i get error

      knet.php
    • By Kian
      The hook assigns clients to groups based on the number of active domains in their accounts (Active, Grace and Redemption). This is particularly useful for Domain Pricing slabs. Let's take this code as example.
      $groups['1'] = '10'; $groups['2'] = '25'; $groups['3'] = '100'; The key of $groups array (eg. ['1']) represents the ID of the group while the value the number of active domains. According to the above configuration, here is what happens:
      Customer A has 10 domains. He goes to client group ID 2. Next day domains become 9. The the customer is removed from the group Customer B has 99 domains. He still goes to client group ID 2 but will be moved to 3 in case he manages to reach 100 domains Customer C has 250 domains. Group ID 3 The hook runs with WHMCS daily cron job meaning that customers are moved (or removed) from groups on a daily basis. Optionally, you can use the following feature to add some restrictions:
      $activeCustomers rules apply only on Active customers (boolean true or false) Get the Code »
    • By Kian
      This hook is similar to the one that assigns clients to groups based on purchases. This time we're assigning clients to groups based on registration date or more precisely on user seniority. Let's take this code as example.
      $groups['1'] = '90'; $groups['2'] = '180'; $groups['3'] = '365'; They key of $groups array (eg. ['1']) represents the ID of the group while the value user seniority (days between registration date and current date). According to the above configuration, here is what happens:
      Customer A registered 34 days ago. No change Customer B registered 90 days ago. He goes to client group ID 2 Customer C registered 364 days ago. Still group ID 2 Customer D registered 500 days ago. He goes to client group ID 3 Optionally, you can turn on any of the following features to add some restrictions:
      $activeCustomers rules apply only on Active customers (boolean true or false) $oldestPurchase rules apply only on if customer has a product/service or domain older than the given number of days (integear) The hook runs with WHMCS daily cron job meaning that tomorrow the customer C of the above example will move from group 2 to 3.
      Get the Code »
  • 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