Question

I'm using the following and getting the same error over and over again; and notice: both AMT and ITEMAMT = $paymentAmount.

I cannot, for the love of $deity, understand WHY aren't the amounts matching.

$grandtotal = 0;
for ($i = 0;$i < $numItems;$i++) {
    $subtotal = $theBasket[$i]['item_preco'] * $theBasket[$i]['item_qty'];
    $grandtotal += $subtotal;
    echo $subtotal.'<br>';
    $mCq .= '&L_PAYMENTREQUEST_0_NAME'.$i.'='.htmlentities($theBasket[$i]['item_nome']).
        '&L_PAYMENTREQUEST_0_AMT'.$i.'='.$theBasket[$i]['item_preco'].
        '&L_PAYMENTREQUEST_0_QTY'.$i.'='.$theBasket[$i]['item_qty'];
}

for loop returns this:

&L_PAYMENTREQUEST_0_NAME0=HAMSÁ BRACELET RING

&L_PAYMENTREQUEST_0_AMT0=9

&L_PAYMENTREQUEST_0_QTY0=1

$paymentAmount = number_format($grandtotal,2);

        $nvpstr = $mCq;
        $nvpstr .= '&PAYMENTREQUEST_0_AMT='.$paymentAmount;
        $nvpstr .= '&PAYMENTREQUEST_0_ITEMAMT='.$paymentAmount;
        $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
        $nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
        $nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
        $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
Was it helpful?

Solution

Well. I got it fixed. The thing is: the error it says it has it's not the error that "breaks the link".

Instead of this being a 10413 (total amounts whatnot whatever) This is a simple case of "field is missing"; In this case, '&L_PAYMENTREQUEST_0_NUMBER'.$i.'='.$theBasket[$i]['ct_item_id']. '&L_PAYMENTREQUEST_0_DESC'.$i.'=descricao'. Those where the ones missing

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top