Sunday, 28 March 2010

Configuring ZenCart and PayPal: Error 10413 solved

Now that PayPal is coming to South Africa, I figured that I’d upgrade my ZenCart site to connect to PayPal’s express checkout. 
I enabled ZenCart’s “PayPal Express Checkout” payment module and started configuring the parameters.
Oops, I needed to enter some API credentials – so I followed the instructions on how to get those.
I upgraded my PayPal account to “Premier” level so that I could accept payments and get an ‘API username’ and ‘API Password’ and ‘Signature’, and pointed it to “Sandbox” mode.
Sandbox mode? – yup, mmm… that should have got me thinking – but it didn’t. 
I then (naively) tried to process a transaction from my ZenCart using my real PayPal logins and got the following error “10002 Security error - Security header is not valid”.  That gave me further clues that I couldn’t use my real PayPal logins and API settings and use the “Sandbox” mode.  I needed to create new dummy accounts and logins and APIs on the sandbox.PayPal server.

imageSo, I registered as a developer on the site and downloaded the “PayPal_Sandbox_UserGuide” and a few clicks later I was creating the sandbox parameters and users that I could use to test my shopping cart.  I created a few users with different accounts, in different parts of the world, with lots of money so that they could purchase to their hearts’ content.

Then I got to the difficult part. I thought that it would be easy to go from the shopping cart to PayPal and process the payments – BUT, it wasn’t – sometimes the purchases went through fine – others it didn’t.  I didn’t realise that the small transactions worked fine – but not the ones over R1,000.  I kept on getting the 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.”  I Goggle’d a bit – but nothing really helped, until I found this posting by Levi Senft: “ZenCart and PayPal: 10413 Transaction refused because of an invalid argument. Solved!”.  The posting explains how the comma separator is the cause of the problems, as well as a fix.
I modified the paypalwpp.php file as directed and voila – it was solved.  No more error 10413 (that was really starting to haunt me!)

I’m looking forward to many transactions facilitated by PayPal in South Africa.

Update 07April2010:
I’m not sure why, but I started getting the 10413 error again.  Perhaps I didn’t test the above solution thoroughly enough.  I Google’d some more and found this solution by “gmail”:
PayPalZenCartError10413That seemed to work first time – but beware it’s not thoroughly tested.  You can download the modified paypalwpp.php file to save you some typing:  It INcludes both fixes described above  paypalwpp.php

If this still doesn’t help you – then look at the log files: /includes/modules/payment/paypal/logs (ensure that the folder is writable (ie: chmod 777))

I then had problems when shipping charges were included….
The same problem as “Zubey” had here.
Whenever tax was added to on either products or shipping. If tax is removed from both it all works fine.

[ITEMAMT] => 0.20
[AMT] => 0.20
[SHIPPINGAMT] => 0.00 **** when this = 0
[TAXAMT] => 0.00 & this = 0, all works fine ****
[L_NUMBER0] =>
[L_QTY0] => 1
[L_NAME0] => TEST Product No.2 $0.20
[L_AMT0] => 0.20

A bit more searching found me this article:
and I changed these settings and it worked:
Config->My Store-> Basis of Product Tax=Shipping and Basis of Shipping Tax=Shipping
and in Module->Shipping (for each shipping module set): Tax Basis = Store

I hope this is the last time I say that “it’s working” and it isn’t!

1 comment:

  1. Thanks for this post. My employer occasionally encounters this error but often runs smoothly. He doesn't what causes it to be like that. It's really hard to troubleshoot things like this when it becomes so technical and basic knowledge is not enough.


Live Traffic Feed


Be notified of
page updates
it's private
powered by

Copyright © 2008 HandyTechTipper. All articles are released under the Creative Commons Attribution 2.5 South Africa license, unless where otherwise stated.