PayPal Error: the total of items in the cart did not match the total of all items
I have this issue with the cart I am currently completing, the price of each item is made of of several components some of which are flat rate and some of which are a cost multiplied by the qty ordered, the following code is the result of an order which includes an extra which is 20 cents x the qty i.e. $6 which as you can see is the difference between the total of the paymentdetailsitem and itemtotal
<paymentdetails>
<ordertotal currencyid="USD">149.36</ordertotal>
<shippingtotal currencyid="USD">98.36</shippingtotal>
<itemtotal currencyid="USD">51</itemtotal>
<buttonsource>WebAssist.eCartPHP.Pro.DP</buttonsource>
<paymentdetailsitem>
<name>SW-00033</name>
<amount currencyid="USD">1.5</amount>
<quantity>30</quantity>
<number>10033</number>
</paymentdetailsitem>
</paymentdetails>
my question is would I be better passing the line total and hard coding the qty to one in this code block
while ( !$eCart1->EOF() ) {
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Amount" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$eCart1->DisplayInfo("Price") ."";
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Name" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$eCart1->DisplayInfo("Name") ."";
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Number" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$eCart1->DisplayInfo("ID") ."";
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Quantity" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$eCart1->DisplayInfo("Quantity") ."";
$eCart1->MoveNext();
$cartIndex ++;
}
or is there a better way to do this, maybe create a new column with a custom calculation to fill it ?
Thanks.