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 wellconnit
      Hi Guys,
      I'm trying to integrate my WHMCS install with my banks payment gateway, they don't have the best documentation but I think i'm on the right track.
      I've got the preferences sorted and I think i'm most of the way there on getting the capture correct.
      But there are a few things i'm confused with, mainly the result url? The callback file is used for 3D secure transactions only is it not?
      I've added what I've done and the integration guide from the bank, hoping someone can take a look and let me know what I should use as a result url,
      The service doesn't allow for refunds automatically and I've removed the 3D secure function also.
      Just looking at getting the capture right then I can copy the concept to the other function,
       
      Also the documentation from WHMCS is a little lacking. How do we know what parameters are available and for something like the URL i've defined with the test & the live how do I reference the value of that variable?
       
      Any help with this is greatly appreciated.
       
      Thanks.
      nabtransact.php
      Direct_Post_Integration_Guide.pdf
    • By ModulesGarden
      ModulesGarden Payment Gateway Charges For WHMCS is a very useful module allowing you to charge additional fees and set up discounts for usage of chosen payment gateway.
       
      You can decide which of products, addons, domains and other require an additional fee, and choose which of clients will be exempt from fees and discounts. Payment Gateway Charges For WHMCS allows you to display your customers with information about additional fees and available discounts during ordering and also automatically converts different currencies!
       
       
      Features:
       

      Set Different Rates For Different Payment Gateways (Percentage Or Fixed)
      Set Different Discounts For Different Payment Gateways (Percentage Or Fixed)
      Set Minimum Invoice Value To Charge Payments And Discounts
      Include/Exclude From Charges And Discounts Certain Clients
      Include/Exclude From Charges Certain Products, Addons, Domains And Other
      Automatic Conversion Of Charges And Discounts In Different Currencies
      Display/Hide Information About Additional Charges And Discounts During Ordering
      Supports WHMCS V5 and Later

       
      10% Promo Code - Valid Until 31.08.2013:
       

      MGPGC10%

       
      Are You Interested?
      ✔ Order Payment Gateway Charges For WHMCS Now!
       
      Do You Need More Information?
      ✔ Read More About Payment Gateway Charges For WHMCS
       
      Are You Looking For Complete Documentation?
      ✔ Visit Payment Gateway Charges For WHMCS Wiki
       
       
       
      Check Out Also Our Other Products:
       
      ✔ Rackspace Cloud Servers For WHMCS
      ✔ cPanel Manage2 For WHMCS
      ✔ DNS Manager For WHMCS
      ✔ cPanel Extended For WHMCS
      ✔ Rackspace Email For WHMCS
      ✔ Rackspace Email Extended For WHMCS
      ✔ WWD GoDaddy Domains For WHMCS
      ✔ Advanced Billing For WHMCS
      ✔ DirectAdmin Extended For WHMCS
      ✔ Google Apps For WHMCS
      ✔ Plesk Extended For WHMCS
      ✔ Zimbra Email For WHMCS
      ✔ Plesk Extended For WHMCS
      ✔ cPanel Pack For WHMCS
      ✔ Zendesk For WHMCS
      ✔ Resellers For WHMCS
      ✔ Liquid Web For WHMCS
      ✔ Liquid Web Load Balancer For WHMCS
      ✔ Storm On Demand For WHMCS
      ✔ Storm On Demand Load Balancer For WHMCS
      ✔ Storm Servers Billing For WHMCS
      ✔ SolusVM Extended VPS For WHMCS
      ✔ SolusVM Extended Cloud For WHMCS
      ✔ SolusVM Extended Reseller For WHMCS
      ✔ eNom Email For WHMCS
      ✔ Zimbra Email For HostBill
      ✔ DirectAdmin Extended For HostBill
       
       
       
      Coming Later In This Week:
       

      Proxmox Module For WHMCS

       
      Coming Next:
       

      DirectAdmin Extended For WHMCS 1.6
      cPanel Extended For WHMCS 2.2
      MX Registrar Module For WHMCS

       
       
      Do You Need Custom Software Development?
      ✔ Don't hesitate any longer! Contact us now!
       
       
       
      For more information about our promotions, products and company activity visit our Facebook, Forums, Twitter and Blog!
       
      ✔ Facebook
      ✔ Forums
      ✔ Twitter
      ✔ Blog
    • By Roger
      Anyone work with this company? On the surface so far they look good. Looking for feed back. Thanks
       
      -Roger
    • By Deeco
      Hello,
       
      There was a discussion regarding this, ut I can't find it. I want to know what is the best practice on making up the cost of GoCardless surcharge. It is possible to increase my hosting plans by £2 to cover the costs, but I want to know other ways, such as module that will automatically increase the price if the client chooses to pay via GoCardless payment gateway.
       
      Please assist me with this, I know I haven't made perfect sense, so forgive me.
       
      Many thanks.
    • By xex
      Hello,
       
      I want to replace the text for my payment gateway in my cart/checkout page but unfortunately WHMCS say that they cant give me a clue as to where and
       
      how to do this no matter how much I beg or even after offering to pay them. I have asked a few guys on ODESK to help and they quote me 8+ hours of
       
      work to do it for me! I am not a programmer but know it doesnt take that long. In fact, Im pretty sure if I knew where to put what code, I could do it
       
      myself in a few minutes.
       
      I have searched high and low in this forum for help and have seen people get it sorted out in 2007 and 2009 and 2010 but nothing recent. I tried to use
       
      those solutions to clue myself into how to do it after WHMCS has changed so much but of course those solutions are based on old old version of
       
      WHMCS so I havent had much luck.
       
      Here is one that I thought might work-->
       
       
       
      "Thanks to the tips above I was able to accomplish that and place the payment logos on my cart. Here's how I did it:
       
      File: templates/orderforms/default/viewcart.php
       
      Around line 165:
      <p align="center">{foreach key=num item=gateway from=$gateways}<input type="radio" name="paymentmethod" value="{$gateway.sysname}"
       
      id="pgbtn{$num}"{if $selectedgateway eq $gateway.sysname} checked{/if} /><label for="pgbtn{$num}">{$gateway.name}</label> {/foreach}</p>
      Add the following code right after <label for="pgbtn{$num}">{$gateway.name}
      <br />{if $gateway.sysname}<img align="center" src="images/{$gateway.sysname}.gif" />
      {/if}
      <br />
      So it will look like:
      <p align="center">{foreach key=num item=gateway from=$gateways}<input type="radio" name="paymentmethod" value="{$gateway.sysname}"
       
      id="pgbtn{$num}"{if $selectedgateway eq $gateway.sysname} checked{/if} /><label for="pgbtn{$num}">{$gateway.name}<br />
      {if $gateway.sysname}<img align="center" src="images/{$gateway.sysname}.gif" />
      {/if}
      <br /></label> {/foreach}</p>
      Now upload your payment images to the whmcs/images folder. Name them according to the payment gateway name: paypal.gif, banktransfer.gif and so
       
      on.
       
      That's it!"
       
      (here is that origianl post: http://forum.whmcs.com/showthread.php?8523-How-to-add-images-for-gateway-payments)
       
       
       
       
      I found that there is no more viewcart.php, so looked inside of viewcart.tpl and found part of the code mentioned above and so tried to place code for my
       
      image that roughly corresponded to the above solution but it didnt work. See the original code below which is on line 234 of viewcart.tpl, and then see
       
      code after I tried putting my image code into it.
       
       
       
      line 234
      <p class="paymentmethods">{foreach key=num item=gateway from=$gateways}<label><input type="radio" name="paymentmethod"
       
      value="{$gateway.sysname}" onclick="{if $gateway.type eq "CC"}showCCForm(){else}hideCCForm(){/if}"{if $selectedgateway eq
       
      $gateway.sysname} checked{/if} />{$gateway.name}</label><br />{/foreach}</p>
       
       
       
       
      <h2>{$LANG.orderpaymentmethod|strtolower}</h2>
      <p class="paymentmethods">{foreach key=num item=gateway from=$gateways}<label><input type="radio" name="paymentmethod"
       
      value="{$gateway.sysname}" onclick="{if $gateway.type eq "CC"}showCCForm(){else}hideCCForm(){/if}"{if $selectedgateway eq
       
      $gateway.sysname} checked{/if} />{$gateway.name}<br />{if $gateway.sysname}<img align="center" src="images/{$gateway.sysname}paypal-logo-
       
      new-nov2012_sm3.png" />{/if}<br /> </label><br />{/foreach}</p>
       
       
      BTW, I had a logo replacing the text by adding the image code to the Payment Gateways are under Display name, but It stopped working after recent upgrades to WHMCS that force me to use the Force Subscriptions function. So that is no longer an option; Using Forced Subscriptions makes the logo disappear from the form completely.
       
       
       
      Can anyone help me get this to work, or show me how you replaced the text with a logo if you were able to do this yourself?
       
      I would really appreciate it.
       
      Best regards,
      Xex
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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