Jump to content
basic

Payment Gateway selection by Currency

Recommended Posts

Dear All:

 

The "group" solution that WHMCS provides to assign payment gateways results in a lot of unnecessry work -- as every product that s offered in two different (or more) currencies needs to be duplicated. It is further flawed, as this does not work at all for domain registrations!

 

Under version 5.3 of WHMCS we had the below edits working to take care of this, but it does not work anymore in version 6.3.1, and I can't figure out why not. Does anyone understand, and how to fix this?

 

We use "six" and the "modern" shopping card ... the code below is a simplified version with just two currencies and two payment gateways.

 

.../[whms]/templates/orderforms/modern/viewcart.tpl

 

 

------------

(...)
{/if}
<h2>{$LANG.orderpaymentmethod}</h2>
{if $currency.id == 1}
<p><input type="radio" name="paymentmethod" id="pgbtn1" value="paypalbilling" onclick="hideCCForm()"{if $selectedgateway eq "paypalbilling"} checked="checked"{/if} /> <label for="pgbtn1"><b>PayPal</b></label><br />
<input type="radio" name="paymentmethod" value="authorizecim" id="pgbtn2" onclick="showCCForm()"{if $selectedgateway eq "authorizecim"} checked="checked"{/if} /> <label for="pgbtn2"><b>Credit Card</b></label><br />
{if $currency.id == 2}
<input type="radio" name="paymentmethod" value="dwolla" id="pgbtn1" onclick="hideCCForm()"{if $selectedgateway eq "dwolla"} checked="checked"{/if} /> <label for="pgbtn1"><b>Bank Transfer</b></label><br />
<input type="radio" name="paymentmethod" value="coinify" id="pgbtn2" onclick="hideCCForm()"{if $selectedgateway eq "coinify"} checked="checked"{/if} /> <label for="pgbtn2"><b>Bitcoin</b></label>
{/if}</p>
(...)

------------

 

 

Any ideas?

 

Thanks!

John

Share this post


Link to post
Share on other sites

John,

 

you've got 2 opening {if} statements, but you only close one of them... perhaps v5 might have forgiven you for that.. v6 probably won't!

you either need to close both {if} statements or change the second one to use elseif instead - then you effectively only have one {if} statement... and that will be closed correctly.

 

(...) 
{/if} 
<h2>{$LANG.orderpaymentmethod}</h2> 
{if $currency.id == 1} 
<p><input type="radio" name="paymentmethod" id="pgbtn1" value="paypalbilling" onclick="hideCCForm()"{if $selectedgateway eq "paypalbilling"} checked="checked"{/if} /> <label for="pgbtn1"><b>PayPal</b></label><br /> 
<input type="radio" name="paymentmethod" value="authorizecim" id="pgbtn2" onclick="showCCForm()"{if $selectedgateway eq "authorizecim"} checked="checked"{/if} /> <label for="pgbtn2"><b>Credit Card</b></label><br /> 
{elseif $currency.id == 2} 
<input type="radio" name="paymentmethod" value="dwolla" id="pgbtn1" onclick="hideCCForm()"{if $selectedgateway eq "dwolla"} checked="checked"{/if} /> <label for="pgbtn1"><b>Bank Transfer</b></label><br /> 
<input type="radio" name="paymentmethod" value="coinify" id="pgbtn2" onclick="hideCCForm()"{if $selectedgateway eq "coinify"} checked="checked"{/if} /> <label for="pgbtn2"><b>Bitcoin</b></label> 
{/if}</p> 
(...)

Share this post


Link to post
Share on other sites

Hello Brian:

 

Yes -- sorry, actually that double "if" was an error that I only produed (not sure how it happened) in this sample code. In my actual code, which has 3 currencies and more than 2 payment gateways for each, I did use "elseif". Sorry.

 

Using "elseif" though, what happens is that I do see the correct payments gateways for each currency, *but* I see them five (5) times, in idential columns... please SEE the here attached image file.

 

Thanks.

John

vieward.jpg

Share this post


Link to post
Share on other sites

did you add your code inside the {foreach} loop?

if you're using your code, you don't really need the {foreach} and {/foreach} in that block and can remove them...

Share this post


Link to post
Share on other sites

Brian .... many thanks to you!

That was it. The code given in my earlier posting works once the "foreach" opening and closing tag is removed. Great!

 

John

Share this post


Link to post
Share on other sites

Hello Brian

I wanted to know if this script allows WHMCS to display payment gateways based on the

currency selected by client?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By So, who am I ?
      Hello
      I'd like to sell domains with different price and currency for customers who visit from outside my country.
      I'm thinking to use OrderDomainPricingOverride hook to change price for non local customers, I plan to differ local and non local customers by their IP. But before I start, thought to ask here, maybe there's a better built in way of doing it that I couldn't find.
      I see I can add another currency to WHMCS but it says:  Customers who visit your site can then choose to shop in their local currency.
      I don't want customers to have to choose currency, I want local ones to shop with local currency and non local one with non local currency. I still can differ it manually by IPs I know, just want to know if WHMCS has some extra features for it that I can use.
    • By wellconnit
      Hi All,
      Does anyone know if it is possible to make a payment through a custom gateway from outside the WHMCS system?
      I want to let users pay with a credit card using my custom payment gateway through my own website rather than the WHMCS website, since the API does not have any function built in for payment of invoices from the remote API I was going to try and reference the payment gateway file directly. Is there a clean way to pass through the variables that the payment gateway is looking for or should I $_POST the variables and then just overwrite whatever the gateway file is looking for so that I don't need to change the gateway code that currently functions?
      Not sure if I will have to manually run the remote API command to AddInvoicePayment to the system depending on whether it is processed or not.
      Thinking about it like that could this be seen as a functional way of completing a payment?
      If someone has a cleaner/simpler solution I'd be happy to hear it?
      Thanks in advance
    • By ModulesGarden
      1. Just a split second ago, Payment Gateway Charges For WHMCS 2.0 was blasted off to let you supervise the offered payment gateways at a sky-high level. Set out on a journey through some of the greatest new possibilities, taking as much time as you need to tap into their full potential!
       
      Feel the instant flow of freshness triggered by a dynamic new framework. Well-balanced arrangement, minimalist design, and most importantly - more time-effective handling of the module. All of that already within your grasp. See what it means to be really in charge. Lay out multiple tiers of discounts and charges to be implemented whenever an invoice displays a specific value. Still not enough! Configure as many activation conditions as you need for each billing rule to let it be applied only to a specified client group, currency or country. For instance, if you would like to grant a discount or collect a fee from customers who opted for a particular currency, or those who come from a specific country even – you can now go right ahead.
      Most modernizations are several times more powerful when used in practice than they are described on paper. You know what we are implicating, don't you?

      View the complete changelog of Payment Gateway Charges For WHMCS!



      2. If you hear someone persistently knocking on your door right now, it must be Cupid reminding you that yesterday was Valentine's Day! As each year, we could not let this lovely opportunity pass by without thanking you for teaming up with us. First, we wanted to write you a poem, but the lines did not rhyme. Then, we tried our hand at drawing hearts, but ended up with scribbles instead. So we will stick with what we are skilled at best – expressing our appreciation through a heartwarming promotion!

      Put in a good word for your beloved product on our Marketplace and let the 20% discount on any other module or extension that you set your eyes on fall into your embrace! And if you have a big heart capable of accommodating love for many items – review them all and get rewarded for each and every one separately!

      All's fair in love, war, and ModulesGarden!
       

      3. See what's on the list of the latest releases:
      QuickBooks Online For WHMCS – v1.4.2 Support Tickets Filter For WHMCS - v1.1.4 DirectAdmin Licenses For WHMCS - v1.1.1

      Need Custom Software Development For Your Business?
       
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
    • By Reza
      Hi there,
      Today I faced something weird in WHMCS. It does not allow prices more than 8 digits! Some of our prices are more than 8 digits in local currency. 
      Has anyone ever faced similar issue? How to fix this?
    • By ModulesGarden
      There are as many preferences when it comes down to payment methods as people in the world. But there are also two invariable constants: customers crave choice and assurance that their money is safely going to reach the intended recipient.

      Today we are here to offer you a solution which will help you respond to this eternal demand - Stripe SEPA Payments For WHMCS. With it, you will allow your audience to fill in all the information required for financial transactions as well as accept an authorization mandate directly in the WHMCS client area, thus enabling both one-time and recurring charges via the SEPA Direct Debit scheme. Carried out through the foolproof Stripe payment gateway, the whole process will be absolutely secure, swift and carefree for both sides.

      Extend your payment arrangements with our Stripe SEPA Payments For WHMCS to derive bilateral benefits!

      Learn All About Stripe SEPA Payments For WHMCS!



      No one should be forced to work with tools which are totally unintuitive in navigation, unsupportive, and time-consuming on top of that. That is why ModulesGarden is sparing no effort to introduce ever more products like Domain Orders Extended For WHMCS 3.0 – equipped with the ultimately pleasurable, wisely-composed framework in which minimalism and modernity are in perfect equilibrium.

      Gain Revealing Insight Into The Future Of Our Modules!



      Do You Need Custom Software Development For Your Business?
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines