Surcharge on card payment in Magento

I just searched for a solution to surcharge customers for a certain PSP in Magento. The only thing I could find a module which priced at USD 49. I also found a lot of argument about whether card payment surcharge is illegal or against PSP’s policy, to which I do not care. What I do care is a free and easy solution to do the job.

Looking at Promotions -> Shopping Cart Price Rules, we can give discount for some kinds of payment method. But the discount can not be minus, which makes it work as surcharge. However, Magento only validates discount must be positive when saving a shopping cart price rule to database. It does not validate again when applying this rule. Therefore, we can make up a rule, enter discount with a positive value, then change the value to minus in database. That’s all you need to do to surcharge customers.

By the way, I think Magento validation on discount limits its usability. Why not use the salesrule module for both promotions and surcharges? I really like to see the menu Promotions be replaced by Sales Rules. (The word salesrule is already being used as table name and in script.)

11 comments

  1. Pretty slick. I tried the negative discount, which of course didn’t work, but didn’t think of changing it in the database.

  2. My idea for a work-around was to set up an alternative tax rule and then hack the label to show surcharge. Not sure how well it would have worked (still a newbie).

  3. Thanks for the info. There’s also a way not to edit it in the DB. Here’s what you can do.

    1. Open \app\code\core\Mage\Adminhtml\Block\Promo\Quote\Edit\Tab\Actions.php
    2. Find ‘validate-not-negative-number’, probably in line 103 and remove it. Just put a blank as a value or put a comment tag. Save
    3. Open \app\code\core\Mage\Rule\Model\Rule.php
    4. Find ‘Invalid discount amount.’, in line 270 and remove the whole if statement or put a comment tag. Save

    Now you can save a negative discount value.

  4. thank you for sharing your knowledge. I understand editing database is not a desired way in magento, but quick and dirty. Yours definitely is better. Just a reminder: to make changes permanent, use class rewrite (probably you already knew it)

  5. Hi there, can please tell me what you mean by class rewrite? How do I do that? I made it work, however not sure how to make it permanent. Kind Regards Gary

  6. I have tried this solution, which works only for the check payment.
    Indeed, Paypal seems to convert the minus into a plus sign.

    I tried to change it in the paypal data helper… doesn’t work :(

    has someone a solution ??

    thanks

  7. I have reported failure using this solution. I assume paypal module has changed its logic. Maybe now the only solution is Magento surcharge module. I want to do it but, there is other stuff on the go.

  8. I can’t find Payment Method listed anymore in the later ver 1.4. Have you found a way of getting around it?

Leave a comment

Your email address will not be published. Required fields are marked *