cancel
Showing results for 
Search instead for 
Did you mean: 

Line item x is invalid. (270) where amount is a negative value

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

gchq
Member
1 ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

gchq
Member
7 REPLIES 7

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

 

gchq
Member

 

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

Joy
Administrator Administrator
Administrator
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 . 

Hi @mahesh_teck,

 

You got that error because a negative amount is not allowed.

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

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.

Just to be clear on the problem,

You are speaking of line items as the line items object that accepts an array? There are numerous ways to work around this, I am quite certain.