Using QBXML to create a vendor, and the documentation seems wrong

623 views Asked by At

I'm using Quickbooks Web Connector and qbxml to add vendors, bills, and payments to QB. The basic code works fine and adds the vendors, bills, and payments.

The problem that I'm having is that some of the fields seem to be misnamed in xml, specifically IsVendorEligibleFor1099, VendorTaxIdent, IsActive, and a few others that I don't care as much about.

This chunk of code works:

<?xml version="1.0" encoding="utf-8"?>
  <?qbxml version="' . $version . '"?>
  <QBXML>
     <QBXMLMsgsRq onError="stopOnError">
        <VendorAddRq requestID="' . $requestID . '">
           <VendorAdd>
              <Name>' .  substr($arr['company_name'],0,39) . '</Name>
              <CompanyName>' . substr($arr['company_name'],0,39) . '</CompanyName>
              <VendorAddress>
                 <Addr1>' . substr($arr['address'],0,39) . '</Addr1>                     
                 <Country >' . substr($arr['country'],0,29) . '</Country>
              </VendorAddress>
              <Phone>' . substr($arr['phone'],0,19) . '</Phone> 
              <Email>' . $arr['email'] . '</Email> 
              <Contact>' . substr($arr['contact_name'],0,39) . '</Contact>
              <AccountNumber>Payee '. $arr['payee_id'] .'</AccountNumber>
              <Notes>this is a note!</Notes>
           </VendorAdd>
        </VendorAddRq>
     </QBXMLMsgsRq>
  </QBXML>

(sorry about the ugly there)

If I add <IsVendorEligibleFor1099>True</IsVendorEligibleFor1099> QB errors out on import.

Any ideas? (I already know that the various $arr[] items need to be escaped, but that's not the problem here)

1

There are 1 answers

0
Michael Chaney On

Apparently order does matter, among other things. Adding:

<IsVendorEligibleFor1099>%s</IsVendorEligibleFor1099>

Right after the Notes line seems to work, not sure what was causing issues before. It's very picky about the order.