QBXML InvoiceAddRq and Taxes - quickbooks

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.

Related

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 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

quickbooks desktop web connector qbxml: add invoice with CLASS field

I'm trying to add an invoice and populate its CLASS field with a value (I can't post a screenshot of the invoice "CLASS" field because I don't have the reputation, its the field just to the right of "PRICE EACH" field), I don't know how to add the CLASS value in the qbxml.
Here is the xml I'm using and it works:
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq requestID="xxxxxxxx">
<InvoiceAdd>
<CustomerRef>
<FullName>Some company:12 street gotham</FullName>
</CustomerRef>
<TxnDate>2015-01-23</TxnDate>
<RefNumber>TPY125</RefNumber>
<BillAddress>
<Addr1>some bill address</Addr1>
<City>some bill city</City>
<State>some bill state</State>
<PostalCode>some bill zip</PostalCode>
<Country>United States</Country>
</BillAddress>
<ShipAddress>
<Addr1>some ship address</Addr1>
<City>some ship address</City>
<State>some ship state</State>
<PostalCode>some ship zip</PostalCode>
<Country>United States</Country>
</ShipAddress>
<PONumber></PONumber>
<TermsRef>
<FullName>Net 120</FullName>
</TermsRef>
<Memo></Memo>
<InvoiceLineAdd>
<ItemRef>
<FullName>16 Electrical and Lighting</FullName>
</ItemRef>
<Desc>Item 1 Description Goes Here</Desc>
<Quantity>1</Quantity>
<Rate>33.00</Rate>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>';
I'm using QuickBooks Enterprise, Web connector ver: 2.1.0.30. So what do I have to add in the xml for the "CLASS" field?
Thanks in advance.
You can always refer to the QuickBooks OSR for XML reference for QuickBooks desktop:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
In this specific case, you can set the Class on a per line item basis like this:
...
<InvoiceLineAdd>
<ItemRef>
<FullName>16 Electrical and Lighting</FullName>
</ItemRef>
<Desc>Item 1 Description Goes Here</Desc>
<Quantity>1</Quantity>
<Rate>33.00</Rate>
<ClassRef>
<ListID> ... specify a ListID here ...</ListID
<!-- Or, instead of ListID you can specify: -->
<FullName> ... specify Class FullName here ...</FullName>
</InvoiceLineAdd>
...

Error adding sales order with InventoryRef in quickbooks desktop

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.

Is there a way to identify tax row which is added on QuickBooks Canada QBResponse, QB SDK

We have QuickBooks Canada version. When we fetch records for Purchase Order it does returns all the records and along with that returns Tax row which is being added by QuickBooks CA.
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<PurchaseOrderQueryRq requestID="1">
<TxnID>2304-1229340744</TxnID>
<IncludeLineItems>1</IncludeLineItems>
<IncludeLinkedTxns>0</IncludeLinkedTxns>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>EditSequence</IncludeRetElement>
<IncludeRetElement>PurchaseOrderLineGroupRet</IncludeRetElement>
<IncludeRetElement>PurchaseOrderLineRet</IncludeRetElement>
<OwnerID>0</OwnerID>
</PurchaseOrderQueryRq>
</QBXMLMsgsRq>
</QBXML>
The extra row response has is
<PurchaseOrderLineRet>
<TxnLineID>2311-1229340744</TxnLineID>
<ItemRef>
<ListID>490000-1195038595</ListID>
<FullName>Summary GST for purchases</FullName>
</ItemRef>
<Desc>Total GST</Desc>
<Rate>5.0%</Rate>
<ClassRef>
<ListID>40001-1199213409</ListID>
<FullName>Pro Shop:Special orders</FullName>
</ClassRef>
<Amount>798.00</Amount>
<CustomerRef>
<ListID>10000-1193777303</ListID>
<FullName>Receiver General</FullName>
</CustomerRef>
<ReceivedQuantity>0</ReceivedQuantity>
<IsBilled>false</IsBilled>
<IsManuallyClosed>false</IsManuallyClosed>
</PurchaseOrderLineRet>
Is there a way to identify this row.
Issue is, if we want to update this order we need to send all the Order line.
And if we send the last line which is of Tax (generated by QB) , QuickBooks SDK throws error.
MLMsgsRs>
<PurchaseOrderModRs requestID="1" statusCode="3120" statusSeverity="Error" statusMessage="Object "2311-1229340744" specified in the request cannot be found. " />
So we need to exclude this line on the PurchaseOrderModRq
Note : Not all Purchase Order's Last line has this tax row.
Export the tax items and compare the Item Refs in the exported PO data against the list of tax items.

Resources