I'm using Paypal Express Checkout on my website and i receive this error:
SetExpressCheckout API call failed. Detailed Error Message: The totals of the cart item amounts do not match order amounts.Short Error Message: Transaction refused because of an invalid argument. See additional error messages for details.Error Code: 10413Error Severity Code: Error
When i enter a quantity of 1 everything is working fine but when i enter 2 or more i get the error.
I'm using SMARTY Templating.
<form class="pull-right" action="../Checkout/paypal_ec_redirect.php" method="POST">
<input type="hidden" name="L_PAYMENTREQUEST_0_NAME0" value="{$product_naam}"></input>
<input type="hidden" name="L_PAYMENTREQUEST_0_AMT0" value="{$product_productprijs}"></input>
<input type="hidden" name="L_PAYMENTREQUEST_0_QTY0" value="{$product_aantal}"></input>
<input type="hidden" name="PAYMENTREQUEST_0_ITEMAMT" value="{$product_subtotaal}"></input>
<input type="hidden" name="PAYMENTREQUEST_0_TAXAMT" value="{$product_btw}"></input>
<input type="hidden" name="PAYMENTREQUEST_0_AMT" value="{$product_totaalprijs}"></input>
<input type="hidden" name="currencyCodeType" value="EUR"></input>
<input type="hidden" name="paymentType" value="Sale"></input>
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="Check out with PayPal"></input>
</form>
</div>
</div>
</div>
Here is the PHP:
foreach ($getproduct as $row) {
$productaantal = $aantalbesteld;
$productnaam = $row['naam'];
$productprijs = $row['prijs'];
$btwtarief = $row['btw_tarief'];
$btwbedrag = ($productprijs*$aantalbesteld)/100*$btwtarief;
$subtotaal = ($productprijs*$aantalbesteld)-$btwbedrag;
$totaalprijs = $productprijs*$aantalbesteld;
}
//Product
$smarty->assign('product_naam', $productnaam);
$smarty->assign('product_aantal', $productaantal);
$smarty->assign('product_prijs', money_format('%.2n', $productprijs));
$smarty->assign('product_subtotaal', money_format('%.2n', $subtotaal));
$smarty->assign('product_btw', money_format('%.2n', $btwbedrag));
$smarty->assign('product_totaalprijs', money_format('%.2n', $totaalprijs));
$smarty->assign('product_bestelknop', 'Bestellen');
EDIT: Even this isn't working:
<form class="pull-right" action="../Checkout/paypal_ec_redirect.php" method="POST">
<input type="hidden" name="L_PAYMENTREQUEST_0_NAME0" value="{$product_naam}"></input>
<input type="hidden" name="L_PAYMENTREQUEST_0_AMT0" value="5.00"></input>
<input type="hidden" name="L_PAYMENTREQUEST_0_QTY0" value="2"></input>
<input type="hidden" name="PAYMENTREQUEST_0_ITEMAMT" value="10.00"></input>
<input type="hidden" name="PAYMENTREQUEST_0_TAXAMT" value="2.10"></input>
<input type="hidden" name="PAYMENTREQUEST_0_AMT" value="12.10"></input>
<input type="hidden" name="currencyCodeType" value="EUR"></input>
<input type="hidden" name="paymentType" value="Sale"></input>
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="Check out with PayPal"></input>
</form>