We are hitting the buffers on invalid line item when one line item is a negative number
If result = True Then Dim vDebit As Double = Row.Cells(1).Text Dim vCredit As Double = Row.Cells(2).Text Dim vInvNo As Integer = Row.Cells(8).Text Dim vInvoiceDescription As String = Row.Cells(6).ToolTip Dim LineAmount As Double = 0 If vCredit > 0 Then Dim CreditString As String = "-" & CType(vCredit, Double) LineAmount = CType(CreditString, String) Else LineAmount = vDebit End If vTotal += LineAmount objInf.Add("x_line_item=item" & vItemNo, "<|>Invoice " & vInvNo & "<|>" & vInvoiceDescription & "<|>1<|>" & LineAmount & "<|>N") vItemNo += 1 End If
so the line amount will be processed as -10.00 where the customer selects
One invoice $100.00
One Credit $10.00
One Invoice $100.00
Total $190.00
How should this be configured?
Thanks
Solved! Go to Solution.
06-13-2015 03:59 PM - edited 06-13-2015 04:03 PM
Seems the answer is not to have a negative amount in the values - it will still process as $190.00 if the amounts are
$100.00
$10.00
$100.00
Looks like the gateway actually ignores the amounts provided the correct total is given, so by changing the code to
If result = True Then Dim vDebit As Double = Row.Cells(1).Text Dim vCredit As Double = Row.Cells(2).Text Dim vInvNo As Integer = Row.Cells(8).Text Dim vInvoiceDescription As String = Row.Cells(6).ToolTip Dim LineAmount As Double = 0 Dim LineBalance As Decimal = 0 If vCredit > 0 Then Dim CreditString As String = "-" & CType(vCredit, Double) LineAmount = CType(CreditString, String) LineBalance = vCredit Else LineAmount = vDebit LineBalance = vDebit End If vTotal += LineAmount objInf.Add("x_line_item=item" & vItemNo, "<|>Invoice " & vInvNo & "<|>" & vInvoiceDescription & "<|>1<|>" & LineBalance & "<|>N") vItemNo += 1 End If
It will process the line item as a positive number but the total will be correct
06-18-2015 08:04 AM
Seems the answer is not to have a negative amount in the values - it will still process as $190.00 if the amounts are
$100.00
$10.00
$100.00
Looks like the gateway actually ignores the amounts provided the correct total is given, so by changing the code to
If result = True Then Dim vDebit As Double = Row.Cells(1).Text Dim vCredit As Double = Row.Cells(2).Text Dim vInvNo As Integer = Row.Cells(8).Text Dim vInvoiceDescription As String = Row.Cells(6).ToolTip Dim LineAmount As Double = 0 Dim LineBalance As Decimal = 0 If vCredit > 0 Then Dim CreditString As String = "-" & CType(vCredit, Double) LineAmount = CType(CreditString, String) LineBalance = vCredit Else LineAmount = vDebit LineBalance = vDebit End If vTotal += LineAmount objInf.Add("x_line_item=item" & vItemNo, "<|>Invoice " & vInvNo & "<|>" & vInvoiceDescription & "<|>1<|>" & LineBalance & "<|>N") vItemNo += 1 End If
It will process the line item as a positive number but the total will be correct
06-18-2015 08:04 AM
Hi gchq,
Whatever data you pass for the line item fields are not validated. Authorize.Net will only validate the total amount and process what is submitted as the total amount.
Thanks,
Joy
06-18-2015 12:22 PM
AuthorizeInvalidError: {'line_items.1.unit_price': u'-5.00 is less than minimum value 0'}
I got This Error whenever i pass line with the negative unit price as discount .
07-10-2017 11:03 PM
07-11-2017 01:09 PM
Then why the hell can't numbers be negative?
there is ZERO logic to restricting LineItems to Positive numbers if they aren't validated against the total
12-07-2017 04:48 PM
I know I'm late to the party here, but I agree with SampsonProjects. Why can't we add discounts as negative value line items? This is very poorly executed and the problem remains four years after it was brought up.
04-24-2019 11:30 AM
04-26-2019 03:30 PM