How to create an invoice for a sales order Quickbooks Desktop - quickbooks

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.

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 can I get "Time/Costs" account IDs with QBXML?

I'm running this query:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="14.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq>
<IncludeLineItems>1</IncludeLineItems>
<IncludeLinkedTxns>1</IncludeLinkedTxns>
</InvoiceQueryRq>
</QBXMLMsgsRq>
</QBXML>
And I get this invoice line which is an expense created with the "Add Time/Costs" button in Quickbooks Desktop.
<InvoiceLineRet>
<TxnLineID>8E-1343336207</TxnLineID>
<Desc>License and Title</Desc>
<Rate>315</Rate>
<Amount>315.00</Amount>
<ServiceDate>2012-07-26</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000002-1343060273</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
With most invoice lines, there's an item associated with it and I can get the account(s) associated with the item. I want to get the account ListID that's associated with this invoice line, as with other invoice lines. I can get the account name with a GeneralDetailReportQuery, but not the ID, and that report is much harder to work with as I'm importing Quickbooks data into another system.
How can I find the accountID for lines like this?

quickbooks api to add a payment against an invoice with RubyRails app

I am trying to mark an invoice mark as paid and as per my understanding I have to add a payment against the invoice. I am using qbwc gem and it is using qbxml v.13.
I have found out few examples of creating the payment object here https://community-intuit.force.com/developer/s/article/QBO-REST-Apply-payments-to-invoice but the qbxml tag for creating payment is not clear to me.
Here are few xml tags that I have found in OSR ReceivePaymentAddRq, ItemPaymentAddRq etc
But I am still not sure how to create the payment object and which xml tags should be used and help is appreciated, thanks in advance.
A minimal qbXML example looks like this:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="10.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentAddRq>
<ReceivePaymentAdd>
<CustomerRef>
<ListID>F230000-1196864585</ListID>
<!--<FullName>Keith Palmer</FullName>--> <!-- You can specify either ListID or FullName -->
</CustomerRef>
<TxnDate>2007-12-14</TxnDate>
<RefNumber>00612361</RefNumber>
<TotalAmount>195.00</TotalAmount>
<!-- Specify the Invoice TxnID here, or see below for auto-apply... -->
<AppliedToTxnAdd>
<TxnID>12006-1196864828</TxnID>
<PaymentAmount>195.00</PaymentAmount>
</AppliedToTxnAdd>
<!-- If you don't want to apply payments manually to a particular transaction, use <IsAutoApply>true</IsAutoApply> -->
<!-- instead of the <AppliedToTxn> node. QuickBooks will make it's best guess how to apply the payment. -->
</ReceivePaymentAdd>
</ReceivePaymentAddRq>
</QBXMLMsgsRq>
</QBXML>

Is there a way to delete a customer from Quickbooks offline using qbsdk and qbxml?

I want to delete a particular customer from quickbooks using the ListId of that customer . What would be my qbxml request in that case ?
You can use the ListDelRq to delete list-type things (Customers, Items, Vendors, etc.) from QuickBooks.
Refer to the OSR for full syntax:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Your request will look something like this:
?xml version="1.0" encoding="utf-8"?>
<?qbxml version="9.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ListDelRq>
<!-- ListDelType may have one of the following values: Account, BillingRate, Class, Currency, Customer, CustomerMsg, CustomerType, DateDrivenTerms, Employee, InventorySite, ItemDiscount, ItemFixedAsset, ItemGroup, ItemInventory, ItemInventoryAssembly, ItemNonInventory, ItemOtherCharge, ItemPayment, ItemSalesTax, ItemSalesTaxGroup, ItemService, ItemSubtotal, JobType, OtherName, PaymentMethod, PayrollItemNonWage, PayrollItemWage, PriceLevel, SalesRep, SalesTaxCode, ShipMethod, StandardTerms, ToDo, UnitOfMeasureSet, Vehicle, Vendor, VendorType, WorkersCompCode -->
<ListDelType>ENUMTYPE</ListDelType>
<ListID>IDTYPE</ListID>
</ListDelRq>
</QBXMLMsgsRq>
</QBXML>

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