3

AS shown in the title I get an error when trying to use paypal or express checkout as the payment method on my store while Im logged in to any account.

PayPal gateway has rejected request. The totals of the cart item amounts do not match order amounts (#10413: Transaction refused because of an invalid argument. See additional error messages for details).

For guest however it works perfectly fine so I do not know why its happening.

2

Its work for Me try this.

Go to Admin panel locate navigation System >> Configuration >> Sales >> Payment Method >> Choose Paypal (exiting Paypal method which enable in fronted for example Payments Pro (Includes Express Checkout)) >> find "Transfer Cart Line Items" choose option value : No

  • This worked for me. What are the ramifications of setting this to No though? – Impulss Apr 28 '16 at 0:18
  • Is paypal working base currency INR? – Gem Jul 26 '17 at 5:33
  • Paypal does not work on base currency INR, You need to put base default USD currency. @JeevaRathinam – Randhir Yadav Jul 28 '17 at 9:35
  • after changed Transfer Cart Line Items = No, same error occurred? is any other needy? snag.gy/bO6QaG.jpg – Gem Jul 28 '17 at 10:22
  • 1
    NOTE: Please never ever modify a core Magento file. If there's no alternative (using an observer, etc) copy the file in local code pool and overwrite there. You should take a look into file app/code/core/Mage/Paypal/Model/Cart.php line #318. As you can see Magento dispatches an event there that you can use to try to fix this problem. By observing that event you will be able to access the actual Mage_Paypal_Model_Cart object that contains the items and totals of the cart that will be sent to Paypal. – Randhir Yadav Jul 28 '17 at 10:28
0

It was an issue with my TAX cuased by HHVM. Looking at paypal debuging logs the wrong price was being sent to magento causing this problem. The tax robelm is explained here Magento Subtracting Tax from subtotal instead of adding it . Fix was to Set hhvm.enable_zend_sorting = 1 in hhvm/php.ini and then restart HHVM

0

The issue you faced is related to Magento bug due to which the logic of actions of TAX calculation is performed in the wrong order.

To resolve the problem, you just need to navigate to file:

app/code/core/Mage/Sales/Model/Config/Ordered.php

find _getSortedCollectorCodes() function and replace with below code

protected function _getSortedCollectorCodes()
{
    if (Mage::app()->useCache('config')) {
        $cachedData = Mage::app()->loadCache($this->_collectorsCacheKey);
        if ($cachedData) {
            return unserialize($cachedData);
        }
    }
    $configArray = $this->_modelsConfig;
    // invoke simple sorting if the first element contains the "sort_order" key
    reset($configArray);
    $element = current($configArray);
    if (isset($element['sort_order']) && false) {
        uasort($configArray, array($this, '_compareSortOrder'));
        $sortedCollectors = array_keys($configArray);
    } else {

        $sortedCollectors = array_keys($configArray);

        foreach ($configArray as $code => &$data) {
            foreach ($data['before'] as $positionCode) {
                if (!isset($configArray[$positionCode])) {
                    continue;
                }
                if (!in_array($code, $configArray[$positionCode]['after'], true)) {
                    // Also add additional after condition for related total,
                    // to keep it always after total with before value specified
                    $configArray[$positionCode]['after'][] = $code;
                }
                $currentPosition = array_search($code, $sortedCollectors, true);
                $desiredPosition = array_search($positionCode, $sortedCollectors, true);
                if ($currentPosition > $desiredPosition) {
                    // Only if current position is not corresponding to before condition
                    array_splice($sortedCollectors, $currentPosition, 1); // Removes existent
                    array_splice($sortedCollectors, $desiredPosition, 0, $code); // Add at new position
                }
            }
        }

        // Sort out totals with after position specified
        foreach ($configArray as $code => &$data) {
            $maxAfter = null;
            $currentPosition = array_search($code, $sortedCollectors, true);
            foreach ($data['after'] as $positionCode) {
                $maxAfter = max($maxAfter, array_search($positionCode, $sortedCollectors, true));
            }
            if ($maxAfter !== null && $maxAfter > $currentPosition) {
                // Moves only if it is in front of after total
                array_splice($sortedCollectors, $maxAfter + 1, 0, $code); // Add at new position
                array_splice($sortedCollectors, $currentPosition, 1); // Removes existent
            }
        }
    }

    if (Mage::app()->useCache('config')) {
        Mage::app()->saveCache(serialize($sortedCollectors), $this->_collectorsCacheKey, array(
                Mage_Core_Model_Config::CACHE_TAG
            )
        );
    }
    return $sortedCollectors;
}

Note : Please override core file. Do not change core file. Clear cache

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.