N
N
Nissaya2020-02-19 11:16:38
C++ / C#
Nissaya, 2020-02-19 11:16:38

Why does QuickBooks desktop give the "Invalid amount field value" error?

The task is to pay invoices from deposites automatically for all customers. To do this, I create an application that, when the button is clicked, will do everything. I decided that it would be right to create a customer payment, which will pay for all open invoices. I work through qbXML and C# sdk. The XML request looks like this:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <ReceivePaymentAddRq>
            <ReceivePaymentAdd>
                <CustomerRef>
                    <FullName>#1 ASAP Transport Inc</FullName>
                </CustomerRef>
                <RefNumber>LS-2-39</RefNumber>
                <TotalAmount>1000.00</TotalAmount>
                <AppliedToTxnAdd>
                    <TxnID>399DB-1582033551</TxnID>
                    <SetCredit>
                        <CreditTxnID>39A01-1582087066</CreditTxnID>
                        <AppliedAmount>0.00</AppliedAmount>
                    </SetCredit>
                </AppliedToTxnAdd>
            </ReceivePaymentAdd>
        </ReceivePaymentAddRq>
    </QBXMLMsgsRq>
</QBXML>


In response I receive a message:

<?xml version="1.0" ?>
<QBXML>
    <QBXMLMsgsRs>
        <ReceivePaymentAddRs statusCode="3210" statusSeverity="Error" statusMessage="The 
           &quot;receive payment total amount&quot; field has an invalid value &quot;1000.00&quot;.  
           QuickBooks error message: This field contains an invalid character." />
    </QBXMLMsgsRs>
</QBXML>


I tried to change the dot to a comma, to remove decimal numbers in principle. Then error 3040: There was an error when converting the amount "1000" in the field "TotalAmount".

Also tried pasting a similar xml example from the documentation but ended up with the same error. When trying to add Receive Payment via c#, the objects from the example for c# get the same error numbers. I have a similar problem with other operations where I specify amounts (For example, creating an invoice or changing the amount in it) I

use QuickBooks Enterprise Solutions 20.0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nissaya, 2020-02-26
@Nissaya

Problem solved. The point was that quickbooks itself adapted to the local locale and accepted numbers with a comma as a separator. And sdk and everything related to qbxml have clear number format requirements that do not change depending on the region. Thus, when passing a number with a dot, sdk normally accepted it and sent it further to quickbooks, which did not understand this format and returned an error. And the sdk itself did not understand the number with a comma. The solution is to change the region to USA in the windows settings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question