Jump to content

Changing total amount based on payment gateway used


SubZeroFX

Recommended Posts

Dear WHMCS Developers,

I am looking into adding a surcharge when client chooses one of the payment gateways so I am thinking about something like this:

add_hook('ShoppingCartValidateCheckout', 1, function($vars)
{
    if($vars['paymentmethod'] == 'thisone')
    {
        // change final amount
    }
});

 but then I am not sure if it's possible to change the total amount here and how.

If not 'ShoppingCartValidateCheckout' hook then maybe something else?

Link to comment
Share on other sites

23 hours ago, SubZeroFX said:

I am looking into adding a surcharge when client chooses one of the payment gateways

bear in mind that it is now illegal, in the EU, to charge a surcharge/fee to a customer for payments made by debit/credit cards - and that also includes PayPal and ApplePay.

if you still want to go down the road of surcharging your customers, based on their payment gateway choice, there are a few products available in Marketplace that can do what you want - do a search there for 'gateway fees'.

Link to comment
Share on other sites

4 minutes ago, brian! said:

bear in mind that it is now illegal, in the EU, to charge a surcharge/fee to a customer for payments made by debit/credit cards - and that also includes PayPal and ApplePay.

if you still want to go down the road of surcharging your customers, based on their payment gateway choice, there are a few products available in Marketplace that can do what you want - do a search there for 'gateway fees'.

We want to apply surcharge for totally different payment gateway.

I also wanted to code this function myself so that's why I am asking here on devs community.

Link to comment
Share on other sites

On 2/7/2018 at 12:12, SubZeroFX said:

I also wanted to code this function myself so that's why I am asking here on devs community.

as a rule, I generally don't like to explain how to do something like this, when there are existing commercial products in Marketplace that do the same task... e.g if I explain the method, what's the point of others buying those products?

if someone else wants to explain to you how to do it, then that's their choice.

Link to comment
Share on other sites

7 hours ago, brian! said:

as a rule, I generally don't like to explain how to do something like this, when there are existing commercial products in Marketplace that do the same task... e.g if I explain the method, what's the point of others buying those products?

if someone else wants to explain to you how to do it, then that's their choice.

I thought this is a Developers corner, not commercial?

I also thought digging into code, developing things, helping each other inside developer community is suppose to be a good thing.

Kinda strange that I have to explain myself why and what I want to do exactly. I am not developing any commercial product for WHMCS, I just want to code here.

Link to comment
Share on other sites

On 2/9/2018 at 01:46, SubZeroFX said:

I thought this is a Developers corner, not commercial?

well i'm not responsible for what it's called. :smile2:

On 2/9/2018 at 01:46, SubZeroFX said:

I also thought digging into code, developing things, helping each other inside developer community is suppose to be a good thing.

then why isn't this corner filled with all those developers, that are currently releasing products, sharing their knowledge with others? because there is no earthly incentive for them to do so, but that's another story that I could easily get sidetracked down.... do not fall into the belief that DC is filled with developers just waiting to answer questions... it's not.

the reality is that there are literally only a handful of users who even reply in DC (and none of us are paid to be here), and a couple of that handful will be WHMCS staff.... so that is a very very small percentage of available WHMCS developers... most of the rest only come here to announce the release of their commercial products and have zero interest in replying to these threads.

so as I said previously, I am not preventing anyone else from replying to the thread to explain how to do it - would you have preferred that I just ignored the thread like everyone else??

On 2/9/2018 at 01:46, SubZeroFX said:

Kinda strange that I have to explain myself why and what I want to do exactly.

I didn't ask you to explain why.

On 2/9/2018 at 01:46, SubZeroFX said:

I am not developing any commercial product for WHMCS, I just want to code here.

the fact that you don't want to develop it commercially wouldn't matter to me... this is a public community and if I post the core functionality of a commercial product, then it will potentially damage their sales... therefore, it's a moral decision on my part - if the roles were reversed, I wouldn't want someone to give away the functionally of a commercial product that I had spent time developing.

in the past, i've posted example code here that, miraculously, a few days/weeks later has been released commercially as a product by someone else.... hey it happens... if others choose to do that, then that's up to them.

in any event, the information is out there... there was a free addon years ago that added a percentage/fixed fee to invoices for those paying by different gateways - it's now available on GitHub and you can examine the source code... I just quickly tried it on v7.4.2 and it still works - but bear in mind that it's unlikely to work on v8 as it still uses old MySQL queries, so its code will have to be updated before then.... and unlike what you want to do, it just changes the invoices and is not shown during checkout.

Link to comment
Share on other sites

On 2/8/2018 at 7:46 PM, SubZeroFX said:

I thought this is a Developers corner, not commercial

It is, but as I explained in an earlier post, we're not here to connect the dots for you. if you want someone to hold your hand, connect the dots, then yeah, that's not something that's going to happen. Not here

On 2/8/2018 at 7:46 PM, SubZeroFX said:

I also thought digging into code, developing things, helping each other inside developer community is suppose to be a good thing.

Sure, in a world where we all get paid to sit around and help each other, it is a wonderful thing.
Meanwhile, back in reality land, @brian! said it pretty well

9 hours ago, brian! said:

the reality is that there are literally only a handful of users who even reply in DC (and none of us are paid to be here), and a couple of that handful will be WHMCS staff....

Development time is expensive. Seriously. A professional developer charges quite a bit for their time. I'm not talking cheap hacks that can't code their way outside of [insertframeworkhere] or [insertapihere]. I'm talking true developers, people who spend quality time planning and plotting things, and making sure that things work out of the box. You won't find many users in here with that capability. I try to jump in when I can, but with real life, and the attitude of some of the staff here, there's not much incentive for that.

9 hours ago, brian! said:

I just want to code here.

Great. Take a look at the developers documentation, specifically API and Hook Indexes. Take a look at their own example modules on Github. Tear them apart and put them back together as you would want them to be. Experience is the best place to learn anything.

Like I said, we're here to help, but this isn't a school. Nobody's here to hold your hand and do your work for you. Every once in a while , someone will if it's simple enough, but you need to understand that's a rarity.

Edited by twhiting9275
Link to comment
Share on other sites

  • 3 weeks later...

@SubZeroFX - I understand how you feel and have frequently felt frustrated that if you want something for WHMCS that is not out of the box  - you have to throw $$$s towards the commercial providers to get it.

Now - I am not totally against commercial addons - but there are some definite problems; 

A) some are coded better than others (and you don't really know until you know e.g. get hacked). 

B) Some of the developers are a bit unscrupulous and economical with their language - for example; I have been stung twice by module developers who offer "lifetime updates" so you purchase it thinking it's a once off cost - but then they go and change the "Major Release Version" and apparently that gives them the right to say that your "lifetime updates" don't apply to that new version !!!  So then you end up with another cost for something you thought was a "forever" purchase.

C) A few commercial add ons that are important to your specific business operation, are probably fine - but if you have to add multiple commercial add ons - for every little feature that you need - you are soon looking at a lot of "hidden" or additional cost - which may not be feasible for a small business - and in the end may lead to you deciding that WHMCS is not worth it - and then you move to another solution and that = a lost customer for WHMCS - impacting on the overall ability for them to generate income and therefore continue development.  In other words - the WHMCS eco-system becomes unstable where lots of users start moving elsewhere. Only statistical analysis would reveal how often and to what extent that actually happens and there is no likelihood of us ever knowing those stats from WHMCS - but it can (and does) happen to lots of companies (think: Kodak, Sky, Converse, Atari, AOL) - it probably happened to WHMCS when they got hit with that social engineering issue a few years ago, which is probably partly why they sold to cPanel.

Anyway, not to digress too much - as @brian! mentioned - there's not much incentive in the WHMCS community to help one another.  It's not like a WordPress community which is open source and everyone is sharing for the love of it (unfortunately).  In WHMCS, many of the developers are all wanting to earn $$ from other users.  I guess it's because most are small operators - all looking for a quick buck O.oxD9_9

 

Link to comment
Share on other sites

On 3/3/2018 at 00:15, sol2010 said:

I understand how you feel and have frequently felt frustrated that if you want something for WHMCS that is not out of the box  - you have to throw $$$s towards the commercial providers to get it.

I wouldn't disagree with that - there are LOTS of things that WHMCS should be doing/adding out of the box - but they simply don't... or more accurately, they waste their time on adding fringe features and neglect fixing the core product.... those decisions will bite them on the proverbial at some point.

On 3/3/2018 at 00:15, sol2010 said:

B) Some of the developers are a bit unscrupulous and economical with their language - for example; I have been stung twice by module developers who offer "lifetime updates" so you purchase it thinking it's a once off cost - but then they go and change the "Major Release Version" and apparently that gives them the right to say that your "lifetime updates" don't apply to that new version !!!  So then you end up with another cost for something you thought was a "forever" purchase.

then name them publicly - or even better, add a review on their Marketplace product page (if they have one) to warn others... I could hazard a guess as to who one of them will be.

On 3/3/2018 at 00:15, sol2010 said:

and in the end may lead to you deciding that WHMCS is not worth it - and then you move to another solution and that = a lost customer for WHMCS - impacting on the overall ability for them to generate income and therefore continue development  - the WHMCS eco-system becomes unstable where lots of users start moving elsewhere.

we all have to frequently wonder whether it's worth it in the end... if we're now at the stage where there's no guarantee that it's going to be able to calculate VAT correctly in ALL circumstances, and we would effectively have to double-check the invoices, then it's reasonable to ask, "what is the point?"

On 3/3/2018 at 00:15, sol2010 said:

It's not like a WordPress community which is open source and everyone is sharing for the love of it (unfortunately).

ideally, that's closer to what this place should be like... but it never will be - NEVER.

the idea that there is a community here is a myth being peddled by people that really should know better - at the end of the day, there are literally only a handful of fellow users who are going to regularly answer questions - sentq, twhiting9275, myself... and a few WHMCS staff members who reply.... not necessarily answering the question, but just replying. :P

there are many knowledgeable users who come here and choose not to interact... some lurk in the background (for various reasons); some only visit for commercial reasons.... others just come to ask questions.

i'm sure that there were many others answering questions in the past than there are now... I know some of the reasons why they don't do that any more, but it's not for me to say here.

On 3/3/2018 at 00:15, sol2010 said:

In WHMCS, many of the developers are all wanting to earn $$ from other users.

there's nothing necessarily wrong with that... there are WP developers writing commercial themes and I daresay they're only supporting their own themes rather than the WP userbase in general.

let's be honest, there are (at least) two major problems with WHMCS... fix either and it would ease the situation for the users.

firstly, the internal development is far too slow to ever be considered reasonable - this is not some recipe program where updates are trivially unimportant... this is a billing program, primarily focussed on the hosting/domain sector, where updates are potentially very important, and adding new and requested features in a timely manner is often critical to many businesses.

as some of you may know, one of the features I know most concerns TLDs... now WHMCS's handling of TLDs over the years has been nothing short of shocking.. i'm tempted to use the word embarrassment (too late I have!).

let us take one of the new features of WHMCS v7.5 - Domain Grace Periods & Redemption.... that was requested over 5 years ago, and while there was a free addon that partially did it, there has always been a gaping hole for this feature... my recollection is during one of the beta periods many years ago, that one WHMCS staff member said that it was technically too difficult & complex to do (i'm paraphrasing as, of course, old beta forums get hidden and/or deleted). :wall1:

now i'll make no comment on how the feature works in practice, as I haven't installed v7.5 yet, but purely from reading the documentation, there are aspects that I don't like the look of.... luckily,  I wrote a redemption module for my own use years ago, so there's no real rush to try it on my part.

how many users have lost money over the years because WHMCS didn't have such a feature? more importantly, how many users even know that their installations will probably be giving inaccurate domain results (stating domains are unavailable when they are available)?? you would be amazed at how often I believe that is occurring... but because it doesn't generate a noticeable error, most WHMCS users are blissfully unaware about it... which I suspect is how WHMCS would like them to stay.

so on top of core development being slow, the feature request system is not fit for purpose - we all know it - there is no way that a user should be expected, after submitting a feature request, to wait 3,4,5+ years for it to be implemented - that's just insane... so anyone with sense, will instead either choose to get a developer to do it, or try to code it themselves.

I bet if there was a feature request for a new MarketConnect feature, which might make WHMCS $$$, there wouldn't be a 5 year wait for that!

which brings me on to the second issue - the documentation.... the lack of detail, quality, examples... I could go on... for something like WordPress, it's of less importance because, at least as a last resource, you can examine the core code and try to figure it out that way... with WHMCS, you don't have that option - so you're more reliant on the documentation... and when that is sketchy/missing, you're left with trial & error testing.... then of course, there is the minefield of updates potentially disabling this hook, or that API.. oh what fun!

that then gives the advantage to existing developers, who already know how these things work... so why on earth would they be turkeys voting for Christmas and start sharing what they know in Developer's Corner - there is no reason for them to... and if they're not going to do it off their own back, then you'd end up either punishing them in some way for not doing so, or incentivising them to do it... and both options are fraught with difficulties.

any developer who shares their time and knowledge in DC should be praised... it's a bit of a pointless f0rum given the resources available, but ours is not to reason why.

On 3/3/2018 at 00:15, sol2010 said:

I guess it's because most are small operators - all looking for a quick buck

or simply trying to make a living from their knowledge and filling in the vacuum left by the feature request system, slow core development and poor documentation?

I completely understand what you're saying - feature X should be added by WHMCS, or we should tell you how to do it for yourself... i'm sympathetic to the first, and can understand the frustration of the second.... but we are where we are and regretfully, there is no magic bullet which can fix that.

Link to comment
Share on other sites

Yes, I could go down the route of naming them, but then I have to get into a public shouting match that I don't have the appetite for.

My point was to highlight the flaws of WHMCS reliance on external providers.  Having to name and shame, or test and discover all these addons it's time consuming, expensive and frustrating.  I simply want the core features to be included in the product I am paying for and not have to wait 5 - 10- years for something to be implemented.

 

 

 

Link to comment
Share on other sites

21 minutes ago, sol2010 said:

Yes, I could go down the route of naming them, but then I have to get into a public shouting match that I don't have the appetite for.

then just leave a negative, but civil, review @ Marketplace - fire & forget.... one of three things would happen... 1) developer would ignore it, 2) developer would reply or 3) developer removes products from marketplace - this happened recently with another developer following negative reviews.

I know what you mean though - I discovered yesterday that a prominent poster on here has a clearly racist description on their own website... now I could name & shame here, but as you say, what's the point and what would it achieve...?

23 minutes ago, sol2010 said:

My point was to highlight the flaws of WHMCS reliance on external providers.

if you mean as a company, I don't consider it reliance... I think it's more an attitude of "we're not adding this feature - so it's up to you if you want to pay someone to do it for you"... i'd class that as indifference on the part of WHMCS - which is potentially worse than reliance.

29 minutes ago, sol2010 said:

Having to name and shame, or test and discover all these addons it's time consuming, expensive and frustrating.

tempted to suggest that if more existing users reviewed, then testing would be of less importance... we all know there are fake reviews in Marketplace.

30 minutes ago, sol2010 said:

I simply want the core features to be included in the product I am paying for and not have to wait 5 - 10- years for something to be implemented.

and i've banged that drum for years and it's no closer now than it was years ago... frankly, i'm losing patience with the whole charade.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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