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>
...
Related
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.
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
Version 13.0 of qbxml. Why is the validator listing XML elements that are not in my XML and are not required as something it's expecting?
In all the references I've seen it lists Memo after BillAddress for InvoiceAdd.
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Line: 20
LinePos: 22
Src Text: <BillAddress>
Reason: Element content is invalid according to the DTD/Schema.
Expecting: ItemSalesTaxRef, Memo, CustomerMsgRef, IsToBePrinted, IsToBeEmailed, IsTaxIncluded, CustomerSalesTaxCodeRef, Other, Exchange....
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<InvoiceAddRq requestID="43">
<InvoiceAdd>
<CustomerRef>
<FullName>GORILLA SPRAY FOAM LLC</FullName>
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2017-12-01</TxnDate>
<RefNumber>9690</RefNumber>
<PONumber>JN 102317</PONumber>
<ShipDate>2017-10-23</ShipDate>
<ShipMethodRef>
<FullName>x</FullName>
</ShipMethodRef>
<BillAddress>
<Addr1>GORILLA SPRAY FOAM LLC</Addr1>
<Addr2>2332 HIGHWAY 65</Addr2>
<City>MORA</City>
<State>MN</State>
<PostalCode>55051</PostalCode>
</BillAddress>
<InvoiceLineAdd>
<ItemRef>
<FullName>S 8000</FullName>
</ItemRef>
<Desc>x</Desc>
<Quantity>2</Quantity>
<Amount>x</Amount>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>S 8020</FullName>
</ItemRef>
<Desc>x</Desc>
<Quantity>2</Quantity>
<Amount>x</Amount>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>Delivery Charge</FullName>
</ItemRef>
<Desc>Delivery Charge</Desc>
<Amount>75.00</Amount>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>Sales Tax</FullName>
</ItemRef>
<Desc>Minnesota Sales Tax</Desc>
<Amount>2.58</Amount>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
The order of the tags in qbXML is important.
If the OSR shows, for example, that the ShipMethod, ShipDate, and PONumber tags come AFTER the BillAddress tag, then you MUST follow that order.
Refer to the OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Make sure your tags are in the correct order. Currently they are not due to the ShipDate, ShipMethodRef, and PONumber tags being prior to BillAddress.
I'm using Intuit QuickBooks Pro 2015.
With QBXMLRP2 and with the following XML file I can open the QuickBooks UI and prefill a new invoice with the desired customer, on this case: George Clooney.
<?xml version="1.0" ?>
<?qbxml version="4.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDisplayAddRq requestID = "1">
<TxnDisplayAddType>Invoice</TxnDisplayAddType>
<EntityRef>
<FullName>George Clooney</FullName>
</EntityRef>
</TxnDisplayAddRq>
</QBXMLMsgsRq>
</QBXML>
Until here everything is OK.
My problem is that I need to add items to this invoice.
Then, I try something like:
<?xml version="1.0" ?>
<?qbxml version="4.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDisplayAddRq requestID = "1">
<TxnDisplayAddType>Invoice</TxnDisplayAddType>
<EntityRef>
<FullName>George Clooney</FullName>
</EntityRef>
<InvoiceLineAdd>
<Desc>For the house</Desc>
<Quantity>1</Quantity>
<Rate>120.00</Rate>
</InvoiceLineAdd>
</TxnDisplayAddRq>
</QBXMLMsgsRq>
</QBXML>
but I get the following error:
Exception: QuickBooks found an error when parsing the provided XML text stream.
On the Programmer's Guide I don't find the way to do this:
https://developer-static.intuit.com/qbSDK-current/doc/PDF/QBSDK_ProGuide.pdf
Here are the available XML examples:
https://github.com/IntuitDeveloper/QBXML_SDK13_Samples/tree/master/xmlfiles/legacy
For my example I used specifically, the file: TxnDisplayAdd_Invoice.xml.
My question: How do I add items to this new invoice?
Thanks.
You should refer to the QuickBooks OSR for qbXML reference:
https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html
The supported XML request nodes look like this:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDisplayAddRq>
<!-- TxnDisplayAddType may have one of the following values: Bill, BillPayment, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, VendorCredit -->
<TxnDisplayAddType >ENUMTYPE</TxnDisplayAddType> <!-- required -->
<EntityRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</EntityRef>
</TxnDisplayAddRq>
</QBXMLMsgsRq>
</QBXML>
In short - you can't do what you're trying to do. QuickBooks doesn't support it.
The only thing you can pre-fill is the entity (customer).
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.