Error adding sales order with InventoryRef in quickbooks desktop - quickbooks

I am sending a QBXML to quickbooks for adding a sales order. Everything runs fine but when i add the tag for InventoryRef as below i get XML not valid error.
<SalesOrderLineAdd>
<InventorySiteRef>
<FullName>Austin</FullName>
</InventorySiteRef>
<ItemRef>
<FullName>ES-10BLU</FullName>
</ItemRef>
<Desc>BS10ELU</Desc>
<Quantity>3</Quantity>
<Rate>100.0</Rate>
</SalesOrderLineAdd>
http://www.consolibyte.com/docs/index.php/QbXML_for_Adding_a_Sales_Order
the above link does not have InventorySiteRef as a valid add tag, but the on screen reference on intuit( https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html ) has this field as a valid tag in add request.
Please let me know why i get invalid XML error when i send InventorySiteRef tag as mentioned in OSR?
UPDATE:
<?xml version="1.0" ?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderAddRq>
<SalesOrderAdd defMacro="MACROTYPE">
<CustomerRef>
<FullName>Amazon.com.nvdc, Inc</FullName>
</CustomerRef>
<TxnDate>2014-08-11</TxnDate>
<RefNumber>TST00002H</RefNumber>
<BillAddress>
<Addr1>1600 East Newlands Drive</Addr1>
<City>Fernley</City>
<State>NV</State>
<PostalCode>89408-8903</PostalCode>
<Country>US</Country>
</BillAddress>
<ShipAddress>
<Addr1>1600 East Newlands Drive</Addr1>
<City>Fernley</City>
<State>NV</State>
<PostalCode>89408-8903</PostalCode>
<Country>US</Country>
</ShipAddress>
<SalesOrderLineAdd>
<ItemRef>
<FullName>ES-10BLU</FullName>
</ItemRef>
<Desc>BS10ELU</Desc>
<Quantity>3</Quantity>
<Rate>100.0</Rate>
<InventorySiteRef>
<FullName>Austin</FullName>
</InventorySiteRef>
</SalesOrderLineAdd>
</SalesOrderAdd>
</SalesOrderAddRq>
</QBXMLMsgsRq>
</QBXML>
The above is the request XML which i am sending. I tested it with Quickbooks SDK and it gives me the following error
-2147220480 QuickBooks found an error when parsing the provided XML text stream.
The error occurs only when InventorySiteRef is added. Otherwise it is processed though the OSR shows this tag in request

I have resolved this issue. The qbxml version was the issue. I was using 8.0 which didn't support InventorySiteRef tag in sales order add. I changed it to 12 which supports this tag and it worked like a charm.
Hope it helps someone facing such issue. :)

You should use the Validator program included with the QBXML SDK to see what line is in error.
In this case, InventorySiteRef is not in the correct order. Order does matter and this should be at the end of the SalesOrderLineAdd and not the beginning.

Related

XML Error while Modifying Sales Order in QB Desktop

I am trying to modify a sales order created in QB Desktop. But it gives me XML error
0x80040400: QuickBooks found an error when parsing the provided XML text stream.
Here is my XML Request
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="11.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderModRq>
<SalesOrderMod>
<TxnID>1-1672737866</TxnID>
<EditSequence>1672737866</EditSequence>
<CustomerRef>
<FullName>156004 Loose Bee Ln</FullName>
</CustomerRef>
<TxnDate>2023-01-03</TxnDate>
<BillAddress>
<Addr1>123</Addr1>
<Addr2></Addr2>
<City>Gity</City>
<State>Ritham</State>
<PostalCode>5555</PostalCode>
<Country>Universe</Country>
</BillAddress>
<PONumber>4444444</PONumber>
<Other>Southshore Bay</Other>
<SalesOrderLineMod>
<TxnID>3-1672737866</TxnID
<ItemRef>
<FullName>Single Family - One Story</FullName>
</ItemRef>
<Desc>Foundation</Desc>
<Quantity>1</Quantity>
<Amount>85.00</Amount>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>Lot</DataExtName>
<DataExtValue>8/98</DataExtValue>
</DataExtMod>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>Address</DataExtName>
<DataExtValue>156004 Loose Bee Ln</DataExtValue>
</DataExtMod>
</SalesOrderLineMod>
</SalesOrderMod>
</SalesOrderModRq>
</QBXMLMsgsRq>
</QBXML>
Any help is highly appreciatable..
Whenever you get this error:
0x80040400: QuickBooks found an error when parsing the provided XML text stream
It means you used an XML tag incorrectly, an unsupported XML tag, or an XML tag in the wrong order.
You can refer to the documentation to see what supported tags, their order, etc. are:
https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salesordermod
At least at first glance, I can see that TxnID inside SalesOrderLineMod is not correct (maybe you meant TxnLineID instead?):
<SalesOrderLineMod>
<TxnID>3-1672737866</TxnID
It may also be worth double-checking those DataExtMod tags too.

How to create an invoice for a sales order Quickbooks Desktop

I have a customer in Quickbook Desktop, so that I have generated a slaes order for the particular customer, now for the customer sales order I have to generate a invoice. . When I tried it I got the following error. How to link a quickbook desktop customer sales order to a invoice?
I tried using IDTYPE attribute. What is wrong here? Kindly help
0x80040400: QuickBooks found an error when parsing the provided XML text stream.
Parsing response.
Processing response.
Job 'create_invoice' received response: ''.
This is my sales order xml response.
{"xml_attributes"=>{},
"txn_id"=>"75-1640702627",
"time_created"=>"2021-12-28T14:43:47+00:00",
"time_modified"=>"2021-12-28T14:43:47+00:00",
"edit_sequence"=>"1640702627",
"txn_number"=>37,
"customer_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000001-1640593593", "full_name"=>"Test Customer"},
"template_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000008-1640593060", "full_name"=>"Custom Sales Order"},
"txn_date"=>"2021-12-28",
"ref_number"=>"18",
"bill_address"=>{"xml_attributes"=>{}, "addr1"=>"212 W. Chskskss St.", "addr2"=>"Ste.100", "addr3"=>"wqw, Parròquia d'Encamp www", "addr4"=>"Andorra"},
"bill_address_block"=>{"xml_attributes"=>{}, "addr1"=>"212 W. Chskskss St.", "addr2"=>"Ste.100", "addr3"=>"wqw, Parròquia d'Encamp www", "addr4"=>"Andorra"},
"due_date"=>"2021-12-28",
"ship_date"=>"2021-12-28",
"subtotal"=>1.0,
"sales_tax_percentage"=>0.0,
"sales_tax_total"=>0.0,
"total_amount"=>1.0,
"is_manually_closed"=>false,
"is_fully_invoiced"=>false,
"is_to_be_printed"=>true,
"is_to_be_emailed"=>false}
Trying to generate invoice for this particular sales order
Here is my invoice XML attributes that I am sending to Quickbook Desktop
xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq >
<InvoiceAdd>
<CustomerRef>
<FullName>Test Customer</FullName >
</CustomerRef>
<BillAddress>
<Addr1>212 W. Chskskss St.</Addr1>
<Addr2>Ste.100</Addr2>
<City>wqw</City>
<State>Parròquia d'Encamp www</State>
<PostalCode>06268</PostalCode>
<Country>Andorra</Country>
</BillAddress>
<InvoiceLineAdd>
<ItemRef>
<FullName >Inspection Request</FullName>
</ItemRef>
<Desc >plants</Desc>
<Quantity >1</Quantity>
<Amount >50.00</Amount>
</InvoiceLineAdd>
<LinkToTxnID>75-1640702627<LinkToTxnID>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>'
First thing coming to my mind is: "Where is your closing QBXML tag?"
</QBXML>
Beside that. The SDK includes an XML Validator tool which you can use to validate the XML structure. Try to use this to see where your structure probably does not meet the requirements.

QBXML SalesOrderAdd issue

I am trying to create SalesOrder through QBWebConnector (backend - Rails + qbwc), following Onscreen Reference for Intuit Software Development Kits, and it says that SalesOrderAdd requires only CustomerRef attribute, but QBXML validator says:
Line: 10
LinePos: 9
Src Text: </SalesOrderAdd>
Reason: Element content is incomplete according to the DTD/Schema.
Expecting: ClassRef, TemplateRef, TxnDate, RefNumber, BillAddress, ShipAddress, PONumber, TermsRef, DueDate, SalesRepRef, FOB, ShipDate.
QBXML Request is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderAddRq>
<SalesOrderAdd>
<CustomerRef>
<FullName>Test customer</FullName>
</CustomerRef>
</SalesOrderAdd>
</SalesOrderAddRq>
</QBXMLMsgsRq>
</QBXML>
Why is that? Can I change this behavior somehow (omit all tags except pointed as required in Onscreen Reference)?
The OSR is... less than perfect. But it does indicate there are additional required fields.
You need to add at least one line item or group line.

QBXML InvoiceAdd Error 3250 Feature Not Enabled Or Available

I have been able to create basic invoices via the API with single line items. These have not shipping etc.
Now, when trying to add complete Invoice with the Shipping Line Item (Type = Other Charge). I am getting error 3250 - This feature is not enabled or not available in this version of QuickBooks.
QB Version: Enterprise 2018 Manufacturing Edition w/ Advanced Inventory
InvoiceAddRq Not Working
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<InvoiceAddRq requestID="INV-CREATE|8000B526-1518041862">
<InvoiceAdd>
<CustomerRef>
<ListID>8000B526-1518041862</ListID>
</CustomerRef>
<TemplateRef>
<FullName>FS Invoice</FullName>
</TemplateRef>
<TxnDate>2018-02-07</TxnDate>
<PONumber>WEB-44364</PONumber>
<TermsRef>
<FullName>Prepaid</FullName>
</TermsRef>
<ItemSalesTaxRef>
<FullName>Sales Tax</FullName>
</ItemSalesTaxRef>
<Memo>Web Order Id: 44364</Memo>
<InvoiceLineAdd>
<ItemRef>
<FullName>Shipping Fees</FullName>
</ItemRef>
<Desc>Shipping Charges</Desc>
<Quantity>1.00</Quantity>
<Rate>8.95</Rate>
<Amount>8.95</Amount>
<SalesTaxCodeRef>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<ListID>80000086-1512586876</ListID>
</ItemRef>
<Desc>Product Description</Desc>
<Quantity>1.00</Quantity>
<Rate>22.99</Rate>
<Amount>22.99</Amount>
<InventorySiteLocationRef>
<FullName>RSM</FullName>
</InventorySiteLocationRef>
<SalesTaxCodeRef>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
Simple InvoiceAddRq Working
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<InvoiceAddRq requestID="INV-CREATE|8000B543-1518105265">
<InvoiceAdd>
<CustomerRef>
<ListID>8000B543-1518105265</ListID>
</CustomerRef>
<TemplateRef>
<FullName>FS Invoice</FullName>
</TemplateRef>
<TxnDate>2018-02-08</TxnDate>
<PONumber>WEB-44380</PONumber>
<TermsRef>
<FullName>Prepaid</FullName>
</TermsRef>
<ItemSalesTaxRef>
<FullName>Out of State</FullName>
</ItemSalesTaxRef>
<Memo>Web Order Id: 44380</Memo>
<InvoiceLineAdd>
<ItemRef>
<FullName>WBQB-TMP</FullName>
</ItemRef>
<Desc>Temp Product Entry. Please enter data from WB.</Desc>
<Quantity>1.00</Quantity>
<Rate>1.00</Rate>
<Amount>1.00</Amount>
<SalesTaxCodeRef>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
I have tried searching the docs for some setting in QB I may need to change but have come up empty. Hoping someone can help with this.
This error is usually related to something you don't have turned on in QuickBooks.
If you were to create this same invoice in QuickBooks directly, would you be able to choose all of those options?
Have you tried creating an invoice with an absolute minimum of information? e.g. without the sales tax, without the inventory sites, without the template, without the sales terms, etc.?
I'd bet that you either:
Don't have sales tax enabled
or
Don't have inventory site location tracking enabled

QBXML InvoiceAddRq and Taxes

I'm having an issue trying to get tax applied to an invoice with QBXML. I'm using SalesTaxCodeRef in InvoiceLineAdd but it doesn't seem that it's working for whatever reason. This same code worked for SalesReceiptAddRq. Am I missing a flag or something?
<?xml version="1.0" encoding="UTF-8"?>
<?qbxml version="11.0"?><QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq requestID="c16d1753af62163f3891551c07a1eed493bb291a">
<InvoiceAdd>
<CustomerRef>
<FullName>Customers FullName</FullName>
</CustomerRef>
<TemplateRef>
<FullName>Default Template</FullName>
</TemplateRef>
<TxnDate>2013-07-31</TxnDate>
<RefNumber>12324</RefNumber>
<BillAddress>
<Addr1>Customers FullName</Addr1>
<Addr2>123 Test Dr</Addr2>
<Addr3></Addr3>
<City>Customer City</City>
<State>AL</State>
<PostalCode>12323</PostalCode>
<Country>US</Country>
</BillAddress>
<ShipAddress>
<Addr1>Customers FullName</Addr1>
<Addr2>123 Test Dr</Addr2>
<Addr3></Addr3>
<City>Customer City</City>
<State>AL</State>
<PostalCode>12323</PostalCode>
<Country>US</Country>
</ShipAddress>
<IsPending>false</IsPending>
<IsToBePrinted>false</IsToBePrinted>
<IsToBeEmailed>false</IsToBeEmailed>
<InvoiceLineAdd>
<ItemRef>
<ListID>80000540-1339572998</ListID>
</ItemRef>
<Desc>Item Desc</Desc>
<Quantity>1</Quantity>
<Rate>39.27</Rate>
<SalesTaxCodeRef>
<FullName>SBT</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
For non-USA versions of QuickBooks (CA, UK, etc.):
What you have should work, ASSUMING that the Sales Tax Code "SBT" is correctly mapped to a tax rate in your tax preferences within QuickBooks.
For USA versions of QuickBooks:
Sales tax codes just indicate whether something is TAXable, or NONtaxable. They do NOT actually indicate any tax amount, or force tax to be recorded/charged.
In addition to the Sales tax code, you also need to specify an ItemSalesTaxRef, which is a reference to a specific tax item (a specific tax rate, e.g. 7%).
...
<ItemSalesTaxRef>
<FullName>My Existing Tax Item Name</FullName>
</ItemSalesTaxRef>
<IsToBePrinted>true</IsToBePrinted>
...
CHeck your XML with the SDK Validator.

Resources