Magento 1.9.1 and Paypal error 10413












1














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?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • 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














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?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • 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












1








1







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?










share|improve this question















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?







magento-1.9 paypal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 '16 at 16:40









Amit Bera

57.2k1374170




57.2k1374170










asked Apr 25 '15 at 14:11









tdw

62




62





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • 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




















  • 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


















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






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












3 Answers
3






active

oldest

votes


















0














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.






share|improve this answer





























    0














    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.






    share|improve this answer





















    • 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



















    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






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "479"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f64790%2fmagento-1-9-1-and-paypal-error-10413%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      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.






      share|improve this answer


























        0














        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.






        share|improve this answer
























          0












          0








          0






          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 25 '15 at 14:21









          paj

          2,60521026




          2,60521026

























              0














              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.






              share|improve this answer





















              • 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
















              0














              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.






              share|improve this answer





















              • 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














              0












              0








              0






              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.






              share|improve this answer












              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.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jan 3 '16 at 16:29









              Gul Web Network

              1,205911




              1,205911












              • 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


















              • 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
















              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




              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











              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






              share|improve this answer


























                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






                share|improve this answer
























                  0












                  0








                  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






                  share|improve this answer












                  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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 13 '18 at 10:17









                  Mukesh Prajapati

                  1,140415




                  1,140415






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f64790%2fmagento-1-9-1-and-paypal-error-10413%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      An IMO inspired problem

                      Management

                      Investment