Jump to content

Invoice customization: Disable a payment method if using "add funds"


dimitrifrom31

Recommended Posts

Here is how to disable 2checkout (can be applied to other payment gateways) for the add funds feature.

The reason behind this is that you are not allowed to use 2checkout for adding funds as per 2checkout terms of service.

 

 

Edit "viewinvoice.tpl":

{if $invoiceitems|strstr:$LANG.addfunds}
{$gatewaydropdown|replace:'<option value="tco">2CheckOut</option>':''}
{else}{$gatewaydropdown}
{/if}

 

 

 

Edit "clientareaaddfunds.tpl":

      
               {foreach from=$gateways item=gateway}
	{if $gateway.sysname!=tco}
                   <option value="{$gateway.sysname}">{$gateway.name}</option>
	{/if}
               {/foreach}

Edited by dimitrifrom31
Link to comment
Share on other sites

aah, you've updated the post and are no longer checking the language file... that's good!

 

two things to check...

 

1. are you sure that it's "Add funds"? the language file defines it as "Add Funds"...

2. try changing $invoiceitems to $invoiceitems.description and see if that helps...

Link to comment
Share on other sites

i'm glad to hear that you got it working...

 

with regards to 1), there would be no need to use multiple entries for the different languages, you would just use the one language file entry...

 

{if $invoiceitems|strstr:$LANG.addfunds}
{$gatewaydropdown|replace:'<option value="tco">2CheckOut</option>':''}
{else}{$gatewaydropdown}
{/if}

Link to comment
Share on other sites

  • 7 months later...

Thanks for sharing the useful piece of code. There's also a chance that a customer creates an Add Funds invoice and doesn't instantly pay it. Then they could attempt to pay it along with a regular invoice using the Mass Pay option (if enabled):

 

- clientarea.php?action=masspay

- clientarea.php?action=masspay&all=true

 

We're currently working to disable 2checkout for mass pay if Add Funds invoice is included, so I'll share the code when done.

 

FYI. Here's what 2co refer to when they suspend your account:

 

"Unfortunately, what you described qualifies as "cash gifting" under our prohibited products list, which can be found here:

https://www.2checkout.com/policies/prohibited-product-list"

Link to comment
Share on other sites

  • 1 month later...
  • 4 years later...
On 04/06/2020 at 19:00, Benjamin Biswas said:

Hello, I added both code into my template but i found it's not working for me. Can anyone ensure me that it's working whmcs 7.10.2! Thanks.

the clientareaaddfunds.tpl change should still work... the invoice one might need some tweaking (haven't tested it in years) - though I would argue in both cases, that you shouldn't rely on a 5 year-old thread for code to be used in a more recent WHMCS install and would use hooks instead to achieve the same goal.

Link to comment
Share on other sites

  • 2 years later...

Hello,

Need too,

1. clientareaaddfunds.tpl working good in 8.5.1

2. viewinvoice.tpl not working.

In html checking it same 

<option value="tco">2CheckOut</option>

in 

$LANG.addfunds

All ok, but not working. Help please. Think some wrong in 

$invoiceitems
Edited by Evgeny
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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