4

We are using the Intuit API V2 to import Invoices from QuickBooks Online.

We expect the "TotalAmt" field to be present on all the invoices. There are a couple of invoices that at one point in the past had the "TotalAmt" present but now the "TotalAmt" field is missing and the "Balance" is equal to 0.

Is this a bug or expected behavior?

Edit: this is one of the responses we got from the QuickBooks API (I changed only the indentation and replaced real data with 3 dots):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>    
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo" xmlns:qbp="http://www.intuit.    com/sb/cdm/qbopayroll/v1">
  <Id idDomain="QBO">36673</Id>
  <SyncToken>1</SyncToken>
  <MetaData>
    <CreateTime>2013-04-10T15:24:03-07:00</CreateTime>
    <LastUpdatedTime>2013-04-11T08:32:11-07:00</LastUpdatedTime>
  </MetaData>
  <Header>
    <DocNumber>...</DocNumber>
    <TxnDate>2013-04-10-07:00</TxnDate>
    <Note>...</Note>
    <CustomerId idDomain="QBO">464</CustomerId>
    <ToBePrinted>true</ToBePrinted>
    <ToBeEmailed>false</ToBeEmailed>
    <SalesTermId idDomain="QBO">1</SalesTermId>
    <DueDate>2013-04-10-07:00</DueDate>
    <BillAddr>
      <Line1>...</Line1>
      <City>...</City>
      <CountrySubDivisionCode>...</CountrySubDivisionCode>
      <PostalCode>...</PostalCode>
      <Tag>CUSTOMER</Tag>
    </BillAddr>
    <ShipAddr>
      <Line1>...</Line1>
      <City>...</City>
      <CountrySubDivisionCode>...</CountrySubDivisionCode>
      <PostalCode>...</PostalCode>
      <Tag>CUSTOMER</Tag>
    </ShipAddr>
    <ShipMethodId idDomain="QBO"/>
    <Balance>0.00</Balance>
    <DiscountTaxable>true</DiscountTaxable>
  </Header>
  <Line>
    <Desc>...</Desc>
    <Taxable>false</Taxable>
    <ItemId idDomain="QBO">5</ItemId>
    <UnitPrice>450</UnitPrice>
    <Qty>1</Qty>
  </Line>
</Invoice>
4

2 回答 2

1
<Balance>0.00</Balance> 

It indicates the amount associated with that invoice is 0. In this case, response XML doesn't include any "TotalAmt" field.

There can be couple of cases where 'TotalAmt' doesn't get included.

1.

I had created an invoice with amount as 0. PFB that invoice record in QBO and the corresponding response XML.

enter image description here

<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
  <Id idDomain="QBO">50</Id>
  <SyncToken>0</SyncToken>
  <MetaData>
    <CreateTime>2013-07-01T01:59:37-07:00</CreateTime>
    <LastUpdatedTime>2013-07-01T01:59:37-07:00</LastUpdatedTime>
  </MetaData>
  <Header>
    <DocNumber>1016</DocNumber>
    <TxnDate>2013-07-01-07:00</TxnDate>
    <CustomerId idDomain="QBO">6</CustomerId>
    <ToBePrinted>false</ToBePrinted>
    <ToBeEmailed>true</ToBeEmailed>
    <SalesTermId idDomain="QBO">3</SalesTermId>
    <DueDate>2013-07-31-07:00</DueDate>
    <BillAddr>
      <Line1>Park Avenue NY</Line1>
      ...
    </BillAddr>
    <ShipAddr>
      <Line1>Park Avenue NY</Line1>
      ... 
    </ShipAddr>
    <BillEmail>john_doe@digitalinsight.mint.com</BillEmail>
    <ShipMethodId idDomain="QBO" />
    <Balance>0.00</Balance>
    <DiscountTaxable>true</DiscountTaxable>
  </Header>
  <Line>
    <Desc>Beer HB</Desc>
    <Taxable>true</Taxable>
    <ItemId idDomain="QBO">4</ItemId>
  </Line>
</Invoice>

2.

If you don't pass any value in the 'Amount' field of tag or If you skip that field altogether.

PFB sample request and response.

Request

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns2="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:ns3="http://www.intuit.com/sb/cdm/qbo">
    <Header>
        <Msg>Testing</Msg>
        <CustomerId>6</CustomerId>
    </Header>
    <Line>
        <Desc>Pens</Desc>
        <Amount></Amount>
        <Taxable>true</Taxable>
        <ItemId>3</ItemId>
        <UnitPrice>450</UnitPrice>
        <Qty>1</Qty>
    </Line>
</Invoice>

Response

<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
    <Id idDomain="QBO">57</Id>
    <SyncToken>0</SyncToken>
    <MetaData>
        <CreateTime>2013-07-01T02:48:48-07:00</CreateTime>
        <LastUpdatedTime>2013-07-01T02:48:48-07:00</LastUpdatedTime>
    </MetaData>
    <Header>
        <DocNumber>1022</DocNumber>
        <TxnDate>2013-07-01-07:00</TxnDate>
        <Msg>Testing</Msg>
        <CustomerId idDomain="QBO">6</CustomerId>
        <ToBePrinted>false</ToBePrinted>
        <ToBeEmailed>false</ToBeEmailed>
        <DueDate>2013-07-01-07:00</DueDate>
        <BillAddr>
            <Line1>Park Avenue NY</Line1>
            ...
        </BillAddr>
        <ShipAddr>
            <Line1>Park Avenue NY</Line1>
            ...
        </ShipAddr>
        <ShipMethodId idDomain="QBO" />
        <Balance>0.00</Balance>
        <DiscountTaxable>true</DiscountTaxable>
    </Header>
    <Line>
        <Desc>Pens</Desc>
        <Taxable>true</Taxable>
        <ItemId idDomain="QBO">3</ItemId>
        <UnitPrice>450</UnitPrice>
        <Qty>1</Qty>
    </Line>
</Invoice>

I guess, the second one is applicable in your case.

Please let me know if it answers your qts.

Thanks

于 2013-07-01T09:17:08.167 回答
0

It looks like the Amount in the Line is not being set. The Amount is a required field that needs to be set. Here is the doc: https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/invoice

The total amount field will be calculated

thanks
Jarred

于 2013-06-18T12:41:36.090 回答