News:

Looking for documentation? Take a look on our wiki

Main Menu

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

Started by rajeev108, June 01, 2011, 14:07:26 PM

Previous topic - Next topic

rajeev108

I am using VirtueMart 1.1.18 and PayPal Pro. On trying to make a payment with credit card using PayPal API I get the following error:


Error: Error - Paypal did not complete the transaction - FAILURE - SHORTMESSAGE =Transaction refused because of an invalid argument. See additional error messages for details. -
ERRORCODE =10413 -
LONGMESSAGE =The totals of the cart item amounts do not match order amounts. -
&PAYMENTACTION=Sale&IPADDRESS=127.0.0.1&CREDITCARDTYPE=Visa&ACCT=xxx&EXPDATE=042012&EMAIL=xxx%40yahoo.co.uk&FIRSTNAME=Test&LASTNAME=User&CVV2=000&STREET=test+address1&CITY=Test+city&STATE=EN&COUNTRYCODE=GB&ZIP=XX15+3XX&SHIPPINGAMT=6.39&CURRENCYCODE=GBP&TAXAMT=0.2&DESC=&INVNUM=66_27c5232b7ce2d762f&BUTTONSOURCE=Virtuemart_Cart_DP&L_AMT0=1&L_QTY0=1&L_NAME0=Hammer&ITEMAMT=1&AMT=8.87&SHIPTONAME=Test+User&SHIPTOSTREET=test+address1&SHIPTOSTREET2=test+address+2&SHIPTOCITY=Test+city&SHIPTOSTATE=EN&SHIPTOZIP=XX15+3XX&SHIPTOCOUNTRYCODE=GB
Error: Error - Paypal did not complete the transaction. Please try again in a little while.
Error: Failure in Processing the Payment (ps_paypal_api)

I have one product with price £1 and shipping charge of £6.39. The VAT on product is £0.20 and the VAT on shipping is £1.28.

The total amount (AMT) is correctly shown as £8.87 (1 + 6.39 + 0.20 + 1.28, ie item amount + shipping amount + item VAT + shipping VAT). I can see correct value for ITEMAMT (1), AMT (8.87) but the TAXAMT is just 0.20 which covers the product VAT but not the shipping VAT. Is this wrong? Is the shipping vat suppose to be added to the TAXAMT field? I hope someone can shed some light on why this transaction is not processing.

Regards
Rajeev

rajeev108

I made the shipping rate to be zero. This allowed me to check out properly so the issue is definitely with shipping vat. Is there a bug in ps_paypal_api which needs to be addressed?

rajeev108

I have resolved the problem by modifying ps_paypal_api.php line 1748 to be:

$ship_total = isset($d['shipping_total']) ? round($d['shipping_total'] + $d['shipping_tax'] ,2) : 0;

It seems that elsewhere the SHIPPINGAMT field of PayPal API is set with value including shipping VAT but here it is not. For example, if we look at line 1653 it is clearly adding shipping VAT:

$shippingamt = round($order_totals['order_shipping']+$order_totals['order_shipping_tax'],2);

It seems to be a bug in VirtueMart and I am new to the product so those who are familiar with the product can report it as a bug and get it rectified in future additions.