user1855093
user1855093

Reputation: 373

How to query for multiple invoices with quickbooks QBXML InvoiceQueryRq?

I'm using PHP to generate QBXML to query quickbooks to find an invoice record. This is working. However, now I want to query for two different invoice RefNumbers.

This is my current code to query one invoice:

$qbxml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
         <InvoiceQueryRq requestID="' . $requestID . '">
          <RefNumber>' . $ID . '</RefNumber>
          <IncludeLineItems>true</IncludeLineItems>
        </InvoiceQueryRq>
    </QBXMLMsgsRq>
</QBXML>';  

How would I format it to search for RefNumber = $ID OR RefNumber = $ID2?

Upvotes: 1

Views: 575

Answers (1)

Keith Palmer Jr.
Keith Palmer Jr.

Reputation: 27952

If you refer to the QuickBooks OSR documentation:

https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html

You can see that RefNumber is documented as:

<RefNumber >STRTYPE</RefNumber> <!-- optional, may repeat -->

Key words there:

may repeat

So:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="11.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
         <InvoiceQueryRq requestID="abc1234">
          <RefNumber>1</RefNumber>
          <RefNumber>2</RefNumber>
          <RefNumber>3</RefNumber>
          <IncludeLineItems>true</IncludeLineItems>
        </InvoiceQueryRq>
    </QBXMLMsgsRq>
</QBXML>

Side note, qbXML version 2.0 is from QuickBooks 2003 (e.g. 14+ years old) so you might want to bump that up a bit to something newer:

<?qbxml version="2.0"?>

Upvotes: 1

Related Questions