Search code examples
c#wcfquickbooksqbxml

Quick Books Qbxml to create an invoice with No line items (empty transaction)


At the company where I work, we have the following technologies in Dev environment - company's own C# web application called companyABCDevapplication - installation of Quick Books Web Connector - installation of Quick books Quickbooks Desktop 2017 Premier Trial Version

I've been tasked with creating an interfacing Web service that will be invoked by a Quick Books Web Connector Installation to communicate with our companyABCDevapplication

Here are the technologies being used for local development:

  • Intuit Quickbooks Desktop 2017 Premier Trial Version

  • Intuit QuickBooks Web Connector Version 2.2.0.71

  • Microsoft Visual Studio Enterprise 2015

  • Version 14.0.25431.01 Update 3

  • Microsoft .NET FrameworkVersion 4.6.01055

    <?xml version="1.0" encoding="utf-16"?>
    <?qbxml version="13.0"?>
    <QBXML>
        <QBXMLMsgsRq onError="stopOnError">
           <InvoiceAddRq requestID="0">
                <InvoiceAdd defMacro="TxnID:8465928136">
                    <CustomerRef>
                        <FullName>la lakers</FullName>
            </CustomerRef>       <TemplateRef>
                       <FullName>Intuit Product Invoice</FullName>
            </TemplateRef>
          </InvoiceAdd>
        </InvoiceAddRq>
      </QBXMLMsgsRq>
    </QBXML>
    

If you look at the QBXML code above, you will notice that we want to just create an Invoice in quickbooks but withOut containing items list, but it gives us the following error when our application sends it over to Quickbooks via our Web Service and the Quickbooks Web connector:

<?xml version=\"1.0\" ?>
<QBXML>
       <QBXMLMsgsRs>
                  <InvoiceAddRs requestID="0" statusCode="3180" statusSeverity="Error" statusMessage="There was an error when saving a Invoice.  QuickBooks error message: The transaction is empty." />
        </QBXMLMsgsRs>
 </QBXML>

Is that possible to create an invoice withOut any invoice line items using the QuickBooks Web Connector Version 2.2.0.71 and Quickbooks Desktop 2017 Premier Trial Version? If yes, what should the xml look like? could someone please provide a sample?


Solution

  • Just like when using QuickBooks manually, you need to enter something in the lines in order to save the invoice. However, you don't need to have an item or dollar amount on the invoice, you can simply add information to the Description column. You can't have just a space, though so you may want to have a period or underscore as the description: The XML would look like:

    <?xml version="1.0" encoding="utf-16"?>
    <?qbxml version="13.0"?>
    <QBXML>
        <QBXMLMsgsRq onError="stopOnError">
           <InvoiceAddRq requestID="0">
                <InvoiceAdd defMacro="TxnID:8465928136">
                    <CustomerRef>
                        <FullName>la lakers</FullName>
                    </CustomerRef>
                    <TemplateRef>
                        <FullName>Intuit Product Invoice</FullName>
                   </TemplateRef>
                <InvoiceLineAdd>
                       <Desc>.</Desc>
                </InvoiceLineAdd>
            </InvoiceLineAdd>
      </InvoiceAdd>
    </InvoiceAddRq>
    

    '