cancel
Showing results for 
Search instead for 
Did you mean: 

Paypal refuses transaction 10413

Paypal refuses transaction 10413

 Hello,

 

i am trying to setup PayPal on my new Magento shop.

Everything seems to be configured: products, taxes, shipping origin, shipping method, payments.

 

As soon as i add a test product to my cart (10 € + 22% VAT) i have the right total 12,20€ i go to paypal and i see everything correct (10€+2,20 € VAT).

 

I go on with payment but i get an error:

 

10413 Transaction refused because of an invalid argument. See additional error messages for details.

The totals of the cart item amounts do not match order amounts.

 

Here is the Paypal log:

 

2015-05-12T07:13:37+00:00 DEBUG (7): Array
(
    [url] => https://api-3t.sandbox.paypal.com/nvp
    [SetExpressCheckout] => Array
        (
            [PAYMENTACTION] => Sale
            [AMT] => 12.20
            [CURRENCYCODE] => EUR
            [RETURNURL] => https://www.mydomain.com/index.php/paypal/express/return/
            [CANCELURL] => https://www.mydomain.com/index.php/paypal/express/cancel/
            [INVNUM] => 145000012
            [SOLUTIONTYPE] => Sole
            [GIROPAYCANCELURL] => https://www.mydomain.com/index.php/paypal/express/cancel/
            [GIROPAYSUCCESSURL] => https://www.mydomain.com/index.php/checkout/onepage/success/
            [BANKTXNPENDINGURL] => https://www.mydomain.com/index.php/checkout/onepage/success/
            [LOCALECODE] => it_IT
            [ITEMAMT] => 10.00
            [TAXAMT] => 2.20
            [SHIPPINGAMT] => 0.00
            [L_NUMBER0] => 1
            [L_NAME0] => prova
            [L_QTY0] => 1
            [L_AMT0] => 10.00
            [BUSINESS] => 
            [NOTETEXT] => 
            [EMAIL] => customer@email.com
            [FIRSTNAME] => Mario
            [LASTNAME] => Rossi
            [MIDDLENAME] => 
            [SALUTATION] => 
            [SUFFIX] => 
            [COUNTRYCODE] => IT
            [STATE] => MI
            [CITY] => Milano
            [STREET] => Via Prova 1
            [ZIP] => 20124
            [PHONENUM] => 021234567
            [SHIPTOCOUNTRYCODE] => IT
            [SHIPTOSTATE] => MI
            [SHIPTOCITY] => Milano
            [SHIPTOSTREET] => Via Prova 1
            [SHIPTOZIP] => 20124
            [SHIPTOPHONENUM] => 021234567
            [SHIPTOSTREET2] => 
            [STREET2] => 
            [SHIPTONAME] => Mario Rossi
            [ADDROVERRIDE] => 1
            [METHOD] => SetExpressCheckout
            [VERSION] => 72.0
            [USER] => ****
            [PWD] => ****
            [SIGNATURE] => ****
            [BUTTONSOURCE] => Magento_Cart_Community
        )

    [response] => Array
        (
            [TOKEN] => EC-1M8707294L986462R
            [TIMESTAMP] => 2015-05-12T07:13:37Z
            [CORRELATIONID] => 263efbcb7541a
            [ACK] => Success
            [VERSION] => 72.0
            [BUILD] => 16619266
        )

    [__pid] => 28425
)

2015-05-12T07:14:26+00:00 DEBUG (7): Array
(
    [url] => https://api-3t.sandbox.paypal.com/nvp
    [GetExpressCheckoutDetails] => Array
        (
            [TOKEN] => EC-1M8707294L986462R
            [METHOD] => GetExpressCheckoutDetails
            [VERSION] => 72.0
            [USER] => ****
            [PWD] => ****
            [SIGNATURE] => ****
            [BUTTONSOURCE] => Magento_Cart_Community
        )

    [response] => Array
        (
            [TOKEN] => EC-1M8707294L986462R
            [BILLINGAGREEMENTACCEPTEDSTATUS] => 0
            [CHECKOUTSTATUS] => PaymentActionNotInitiated
            [TIMESTAMP] => 2015-05-12T07:14:26Z
            [CORRELATIONID] => 42572b8a7dc08
            [ACK] => Success
            [VERSION] => 72.0
            [BUILD] => 16619266
            [EMAIL] => paypalaccount@email.com
            [PAYERID] => NEFQP77Y6WEU4
            [PAYERSTATUS] => unverified
            [FIRSTNAME] => Mario
            [LASTNAME] => Rossi
            [COUNTRYCODE] => IT
            [SHIPTONAME] => Mario Rossi
            [SHIPTOSTREET] => Via Prova 1
            [SHIPTOCITY] => Milano
            [SHIPTOSTATE] => MI
            [SHIPTOZIP] => 20124
            [SHIPTOCOUNTRYCODE] => IT
            [SHIPTOPHONENUM] => 021234567
            [SHIPTOCOUNTRYNAME] => Italy
            [ADDRESSSTATUS] => Unconfirmed
            [CURRENCYCODE] => EUR
            [AMT] => 12.20
            [ITEMAMT] => 10.00
            [SHIPPINGAMT] => 0.00
            [HANDLINGAMT] => 0.00
            [TAXAMT] => 2.20
            [INVNUM] => 145000012
            [INSURANCEAMT] => 0.00
            [SHIPDISCAMT] => 0.00
            [L_NAME0] => prova
            [L_NUMBER0] => 1
            [L_QTY0] => 1
            [L_TAXAMT0] => 0.00
            [L_AMT0] => 10.00
            [L_ITEMWEIGHTVALUE0] =>    0.00000
            [L_ITEMLENGTHVALUE0] =>    0.00000
            [L_ITEMWIDTHVALUE0] =>    0.00000
            [L_ITEMHEIGHTVALUE0] =>    0.00000
            [PAYMENTREQUEST_0_CURRENCYCODE] => EUR
            [PAYMENTREQUEST_0_AMT] => 12.20
            [PAYMENTREQUEST_0_ITEMAMT] => 10.00
            [PAYMENTREQUEST_0_SHIPPINGAMT] => 0.00
            [PAYMENTREQUEST_0_HANDLINGAMT] => 0.00
            [PAYMENTREQUEST_0_TAXAMT] => 2.20
            [PAYMENTREQUEST_0_INVNUM] => 145000012
            [PAYMENTREQUEST_0_INSURANCEAMT] => 0.00
            [PAYMENTREQUEST_0_SHIPDISCAMT] => 0.00
            [PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED] => false
            [PAYMENTREQUEST_0_SHIPTONAME] => Mario Rossi
            [PAYMENTREQUEST_0_SHIPTOSTREET] => Via Prova 1
            [PAYMENTREQUEST_0_SHIPTOCITY] => Milano
            [PAYMENTREQUEST_0_SHIPTOSTATE] => MI
            [PAYMENTREQUEST_0_SHIPTOZIP] => 20124
            [PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE] => IT
            [PAYMENTREQUEST_0_SHIPTOPHONENUM] => 021234567
            [PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME] => Italy
            [PAYMENTREQUEST_0_ADDRESSSTATUS] => Unconfirmed
            [L_PAYMENTREQUEST_0_NAME0] => prova
            [L_PAYMENTREQUEST_0_NUMBER0] => 1
            [L_PAYMENTREQUEST_0_QTY0] => 1
            [L_PAYMENTREQUEST_0_TAXAMT0] => 0.00
            [L_PAYMENTREQUEST_0_AMT0] => 10.00
            [L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0] =>    0.00000
            [L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0] =>    0.00000
            [L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0] =>    0.00000
            [L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0] =>    0.00000
            [PAYMENTREQUESTINFO_0_ERRORCODE] => 0
        )

    [__pid] => 23098
)

2015-05-12T07:14:36+00:00 DEBUG (7): Array
(
    [url] => https://api-3t.sandbox.paypal.com/nvp
    [DoExpressCheckoutPayment] => Array
        (
            [TOKEN] => EC-1M8707294L986462R
            [PAYERID] => NEFQP77Y6WEU4
            [PAYMENTACTION] => Sale
            [AMT] => 17.20
            [CURRENCYCODE] => EUR
            [BUTTONSOURCE] => Magento_Cart_Community
            [NOTIFYURL] => https://www.mydomain.com/index.php/paypal/ipn/
            [RETURNFMFDETAILS] => 1
            [ITEMAMT] => 10.00
            [TAXAMT] => 2.20
            [SHIPPINGAMT] => 0.00
            [L_NUMBER0] => 1
            [L_NAME0] => prova
            [L_QTY0] => 1
            [L_AMT0] => 10.00
            [METHOD] => DoExpressCheckoutPayment
            [VERSION] => 72.0
            [USER] => ****
            [PWD] => ****
            [SIGNATURE] => ****
        )

    [response] => Array
        (
            [TIMESTAMP] => 2015-05-12T07:14:35Z
            [CORRELATIONID] => 478f1608bebaf
            [ACK] => Failure
            [VERSION] => 72.0
            [BUILD] => 16619266
            [L_ERRORCODE0] => 10413
            [L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
            [L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
            [L_SEVERITYCODE0] => Error
        )

    [__pid] => 28424
)

Thanks for any suggestion!

6 REPLIES

Re: Paypal refuses transaction 10413

hey there

 

Did you manage to fix this?

 

I had this problem start 2 days ago and have now had 6 transactions I know of with this error code.

Paypal support told me there is a plugin to fix this but dont know what the hell he's talking about. Cant see anything for it.

 

We are a version behind now and wonder if its that. Seen in the list of fixes its mention 1p differances and rounding up/down,

Plan to upgrade now as a fix but wanted to know if there is anything else.

Re: Paypal refuses transaction 10413

I also have the problem with this Error:

 

Das PayPal Gateway hat die Anfrage abgewiesen. 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).""

 

Pls help Smiley Sad

Re: Paypal refuses transaction 10413

We tried even setting "Transfer Cart Line Items" to "No" as a few mentioned should work but upon further testing that didn't help on Magento v1.9.1.1. Sometimes the error appears sometimes it doesn't.

 

We are now changing Tax settings since it looks like it might have somehting to do with the way the totals are reported.

 

Let you know how it went.

 

 

Tags (1)

Re: Paypal refuses transaction 10413

Hello,

 

I also getting same issue in checkout with paypal express.

 

Did you find any solution?

 

 

Thanks.

Re: Paypal refuses transaction 10413

Did You find any solutions for this issue? I have faced this same issue. Sometimes it's showing issue or sometimes not.

Re: Paypal refuses transaction 10413

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