2

I was testing my online store and got this error when I used paypal to checkout: 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).

I have searched here but they relate to version 1.7 or 1.8. Is there a solution for 1.9.1?

  • Is your store run in india, Make sure your products price as the dollar, because of Paypal support only dollar price and your default currency should be a dollar. – Gem Apr 13 '18 at 11:10
1

In my experience this happens occasionally due to decimal rounding differences when multiple cart items are passed to Paypal. To avoid the error completely I disable the Transfer Cart Line items option.

1

You can try our fix:

https://github.com/magento-hackathon/PaypalRoundBugfix

Afaik the problem with

setting transfer cart line items to No

is, that PayPal doesn't then insure your stuff against the customer, so if you are a fraud, the customer doesn'T get their money back from paypal - AFAIK.

  • Is Paypal accept INR as a base currency, if not how can I use Paypal if my base currency INR? – Gem Jul 28 '17 at 9:12
1

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.