quickbooks online api invoice DocNumber - intuit-partner-platform

My script for automatically generating invoices using the V2 api has stopped working even though my code is unchanged. The problem seems to be related to my use of the AUTO_GENERATE flag for the DocNumber field. I need QBO to auto-generate a DocNumber and this method was working fine for me up until today. I tried removing DocNumber completely, which created an invoice, however that invoice had no DocNumber id associated with it which I require. Please let me know if there is a workaround of if something was changed on QBO's side which could be fixed.
Also, please don't ask me to just upgrade to the V3 API, eventually I would like to but this is not feasible right now.
MY HTTP request:
POST /qbo30/resource/invoice/v2/<MY_REALM_ID>
...oauth headers...
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2">
<Header>
<DocNumber>AUTO_GENERATE</DocNumber>
<CustomerId>399</CustomerId>
<SalesTermId>12</SalesTermId>
<Msg/>
<Note>Nov 2013</Note>
</Header>
<Line>
<ItemId>5</ItemId>
<Desc>Clickthrough Advertising</Desc>
<Qty>125</Qty>
<UnitPrice>0.25</UnitPrice>
<Amount>31.25</Amount>
</Line>
<Line>
<ItemId>17</ItemId>
<Desc>Minimum Monthly Charge</Desc>
<Qty>1</Qty>
<UnitPrice>68.75</UnitPrice>
<Amount>68.75</Amount>
</Line>
</Invoice>
QBO's response:
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Date: Mon, 02 Dec 2013 21:19:39 GMT
header: Server: Apache
header: Content-Length: 283
header: Vary: Accept-Encoding
header: Connection: close
header: Content-Type: application/xml
<FaultInfo xmlns="http://www.intuit.com/sb/cdm/baseexceptionmodel/xsd">
<Message>You must specify a different number. This number has already been used.</Message>
<ErrorCode>BAD_REQUEST</ErrorCode>
<Cause>-13006</Cause>
</FaultInfo>

It turns out I had two invoices in our system with the same invoice number. I had to change the number on the offending invoice, then create a new dummy invoice with a higher number which seems to have incremented the auto-increment value appropriately.
Thanks for the comments and the assistance!

Just now, I've tried this. It is working fine for me. PFB details.
Please check if you are missing something.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns2="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:ns3="http://www.intuit.com/sb/cdm/qbo">
<Header>
<DocNumber>AUTO_GENERATE</DocNumber>
<TxnDate>2013-12-02-08:00</TxnDate>
<CustomerId idDomain="QBO">1</CustomerId>
<SubTotalAmt>100.00</SubTotalAmt>
<TotalAmt>100123.00</TotalAmt>
<ToBePrinted>true</ToBePrinted>
<ToBeEmailed>false</ToBeEmailed>
<SalesTermId idDomain="QBO">3</SalesTermId>
<DueDate>2014-01-01-08:00</DueDate>
<ShipMethodId idDomain="QBO" />
<Balance>100321.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>Test</Desc>
<Amount>100.00</Amount>
<Taxable>false</Taxable>
<ItemId idDomain="QBO">2</ItemId>
</Line>
</Invoice>
Response
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">9</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-12-02T23:17:49-08:00</CreateTime>
<LastUpdatedTime>2013-12-02T23:17:49-08:00</LastUpdatedTime>
</MetaData>
<Header>
<DocNumber>1003</DocNumber>
<TxnDate>2013-12-02-08:00</TxnDate>
<CustomerId idDomain="QBO">1</CustomerId>
<SubTotalAmt>100.00</SubTotalAmt>
<TotalAmt>100.00</TotalAmt>
<ToBePrinted>true</ToBePrinted>
<ToBeEmailed>false</ToBeEmailed>
<SalesTermId idDomain="QBO">3</SalesTermId>
<DueDate>2014-01-01-08:00</DueDate>
<ShipMethodId idDomain="QBO" />
<Balance>100.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>Test</Desc>
<Amount>100.00</Amount>
<Taxable>false</Taxable>
<ItemId idDomain="QBO">2</ItemId>
</Line>
</Invoice>
It could be a bug or there could be some issues in your QBO account. Please raise a support ticket for this.
Thanks

Related

How to retrieve GSTN of a company : Tally XML integration

Trying to retrieve the GSTIN of the active company in Tally ERP. Making a POST call using the following **<FETCH>Gstnotificationnumber</FETCH>** command
But no data is returned as part of the response under **<DATA>** output given below
Any help would be really great!!
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>COMPANY</SUBTYPE>
<ID TYPE="Name">Example Company Name</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>Gstnotificationnumber</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
Output From Tally ERP which is missing Gstnotificationnumber from the COMPANY object
Tally Object Schema - (For Reference)
<DATA>
<TALLYMESSAGE>
<COMPANY NAME="Example Company Name" RESERVEDNAME="" REQNAME="Example Company Name">
<NAME TYPE="String">Example Company Name</NAME>
<ISDEEMEDPOSITIVE TYPE="Logical"></ISDEEMEDPOSITIVE>
<CANDELETE TYPE="Logical">No</CANDELETE>
<MASTERID TYPE="Number"> 29</MASTERID>
</COMPANY>
</TALLYMESSAGE>
</DATA>
So the GSTIN number in Tally is not a field belonging to the Company Object. Some of the fields belonging to the Company Object are Address, Phone Number, Email, State etc. For example, modify the <FETCH> tag to have Address and the <DATA> tag in the response will give you the required details.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>COMPANY</SUBTYPE>
<ID TYPE="Name">Example Company Name</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>Address</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
If you look deep into the Tally database structure, the GSTIN Number belongs to the Tax Unit Object. Assuming that default configurations have not been changed for a sample company, the Tax Unit object is usually 'Default Tax Unit'. Now you can query the Tax Unit Object for the company and fetch the GSTIN.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>Tax Unit</SUBTYPE>
<ID TYPE="Name">Default Tax Unit</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVCURRENTCOMPANY>Example Company Name</SVCURRENTCOMPANY>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>GSTRegNumber</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
If you're getting errors in the Tax Unit, it's easier to just use the in-built code to get what you need. There's two ways you can get the GSTIN Number:
By using the formula - CMPGSTaxNumber
By using the direct Object-Method notation : $GSTRegNumber:TaxUnit:##CMPExcisePrimaryGodown
To get these in your XML, you would need to add TDL code within <TDL></TDL> tags in your SOAP request.
A sample is below, if you're interested in reading how the TDL Report structure works, you can refer this document by Tally Solutions.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>GSTReport</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVCURRENTCOMPANY>Example Company Name</SVCURRENTCOMPANY>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<REPORT NAME="GSTReport">
<FORM>GSTReportForm</FORM>
</REPORT>
<FORM NAME="GSTReportForm">
<PART>GSTReportPart</PART>
</FORM>
<PART NAME="GSTReportPart">
<LINE>GSTReportLine</LINE>
<SCROLLED>Vertical</SCROLLED>
</PART>
<LINE NAME="GSTReportLine">
<FIELDS>GSTNumber</FIELDS>
</LINE>
<FIELD NAME="GSTNumber">
<SET>$GSTRegNumber:TaxUnit:##CMPExcisePrimaryGodown</SET>
</FIELD>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>

Creating a comment that gets displayed in generated request? WSDL SOAP xml

Im in the process of writing a wsdl file for an existing system. I'd like to add comments to generated requests.
For instance this:
<xsd:simpleType name="coffeetype">
<xsd:restriction base="xsd:integer">
<!--0=likescoffee,1=doesnotlikecoffe-->
<xsd:enumeration value="0" />
<xsd:enumeration value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="CoffeeRequestInput" nillable="false" type="tns:coffeetype" />
Should look like this in the generated request: (eg. when loading the WSDL in SoapUI)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="https://example.com/some.wsdl">
<soapenv:Header/>
<soapenv:Body>
<!--0=likescoffee,1=doesnotlikecoffe-->
<wsdl:CoffeeRequestInput>0</wsdl:CoffeeRequestInput>
</soapenv:Body>
</soapenv:Envelope>
I was able to see these comments when opening the WSDL but not when generating a request from that WSDL.
Already looked into annotations but I wasn't able to use them to create the result I wanted. (Probably an error on my side)
In short you cannot create documentation in requests as you would like to. However you can generate documentation from your WSDL that can be be very useful. By using the "xsd:documentation" tag you can add documentation directly to the elements.
For example
<xsd:simpleType name="coffeetype">
<xsd:restriction base="xsd:integer">
<xsd:enumeration value="0" />
<xsd:enumeration value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="CoffeeRequestInput" nillable="false" type="tns:coffeetype">
<xsd:annotation>
<xsd:documentation>
This object is the CoffeeRequestInput object is an Enumeration which can be used to determine is the user sending the request likes coffee or not.
Valid values for the enumeration is as follows:
0 = like coffee
1 = does not like coffee (probably a user not a programmer making a request).
Some other things that you need to document goes here.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
You can then use software such as Altova StyleForce, LiquidXML and OxyGen to generate PDF, Word documents or HTML pages which shows the SOAP services and operations with all your comments included.
If you feel up to it you can write your own XLST to transform your WSDL and XSD's into a neat HTML page which documents you interfaces as well. The best part about this is that when you update the WSDL with new operations and so on that the documentation is updated as well.

Google Merchant throws warning "Unrecognized attribute"

I'm facing an issue I can not explain :
When I'm uploading a feed to Google Merchant in an other language than English, the reports tells me there is many "Unrecognized attribute" that should be valid, like title, link, description, gtin, etc.
In fact, all attributes are considered warning from Google.
But the issue only occurs if it's not in english so my feed seems correct.
What is wrong? Do you have any ideas?
Thank for your help.
Here's a dump of my export (strimed to one product) :
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Google Shopping export for PrestaShop</title>
<item>
<g:id xmlns:g="http://base.google.com/ns/1.0">12345</g:id>
<title>
<![CDATA[ Basic title ]]>
</title>
<link>
<![CDATA[
https://www.example.com/test
]]>
</link>
<description>
<![CDATA[
This is a basic product
]]>
</description>
<g:quantity xmlns:g="http://base.google.com/ns/1.0">39</g:quantity>
<g:availability xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[ in stock ]]>
</g:availability>
<g:price xmlns:g="http://base.google.com/ns/1.0">8.54 EUR</g:price>
<g:product_type xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[ Ofertas > Ofertas ]]>
</g:product_type>
<g:google_product_category xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[
AlimentaciĆ³n, bebida y tabaco > Bebidas > Vino
]]>
</g:google_product_category>
<g:shipping_weight xmlns:g="http://base.google.com/ns/1.0">1.4 kg</g:shipping_weight>
<g:online_only xmlns:g="http://base.google.com/ns/1.0">n</g:online_only>
<g:condition xmlns:g="http://base.google.com/ns/1.0">new</g:condition>
<g:brand xmlns:g="http://base.google.com/ns/1.0">Angove Family Winemakers</g:brand>
<g:mpn xmlns:g="http://base.google.com/ns/1.0">23500023</g:mpn>
<g:gtin xmlns:g="http://base.google.com/ns/1.0"/>
<identifier_exists>FALSE</identifier_exists>
<g:image_link xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[
http://example.com/test/images/1.jpg
]]>
</g:image_link>
<g:shipping xmlns:g="http://base.google.com/ns/1.0">
<g:country>ES</g:country>
<g:service>
<![CDATA[ ENVIALIA-72H ]]>
</g:service>
<g:price>24.2 EUR</g:price>
</g:shipping>
</item>
</channel>
</rss>
I presume you are uploading this as XML.
Are you encoding correctly your xml?
If you're submitting an XML file that uses either Latin-1 or UTF-16 encoding, please make sure you specify this information in your XML file. To do this, please change the first line of your data feed from to:
For Latin-1:
<?xml version="1.0" encoding="ISO-8859-1"?>
For UTF-16:
<?xml version="1.0" encoding="UTF-16"?>
I read this from here:
https://support.google.com/merchants/answer/160079
Also, have you tried to use a XML escape tool? Such as http://www.freeformatter.com/xml-escape.html
I hope this helps!
Have you tried changing the "feed type" to "product" instead of "online product inventory update"? There has been a change since 2015.
<identifier_exists>FALSE</identifier_exists>
should be
<g:identifier_exists>false</g:identifier_exists>
also you have excessive CDATA usage. I don't have any in my XML and it works jut fine. try to submit file without CDATA`s

How to give a Class to an QBO v3 entity?

In v2 of QBO we had an ability to pass the Class (e.g. string name of a class) to any of the entities (Customer, Invoice, Payment etc). To be able to sort/group them by the classes. The question is: how to do the same in v3?
Tried to send some Class entities to QBO - they are being created, but never assigned to any of entities. If you give, for example, a Class Reference to an Invoice (setClassRef()) - it won't populate the Class field of Invoice in QBO. And what is more interesting - if you give an existing Class (created via Classes menu of QBO - https://qbo.intuit.com/app/class) to an Invoice in QBO (populate Class field) and then fetch this invoice's entity - it WON'T contain any Class reference information. Which is strange.
Any help will be appreciated.
Please check if you have enabled Class tracking from Preference Tab
Here is one example where class is being referenced from Invoice.
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-03-03T09:14:13.444-08:00">
<QueryResponse startPosition="1" maxResults="1" totalCount="1">
<Invoice domain="QBO" sparse="false">
<Id>1</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-03-03T09:13:52-08:00</CreateTime>
<LastUpdatedTime>2014-03-03T09:13:52-08:00</LastUpdatedTime>
</MetaData>
<DocNumber>1001</DocNumber>
<TxnDate>2014-03-03</TxnDate>
<CurrencyRef name="United States Dollar">USD</CurrencyRef>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Description>Test product desc</Description>
<Amount>0</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Hours">2</ItemRef>
<UnitPrice>0</UnitPrice>
<Qty>1</Qty>
<TaxCodeRef>NON</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>0</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail />
</Line>
<CustomerRef name="Customer123">2</CustomerRef>
<BillAddr>
<Id>2</Id>
<Line1>Customer123</Line1>
<Lat>32.8856854</Lat>
<Long>-96.9343488</Long>
</BillAddr>
<ClassRef name="CLASS-1">3000000000000199718</ClassRef>
<SalesTermRef>3</SalesTermRef>
<DueDate>2014-04-02</DueDate>
<TotalAmt>0</TotalAmt>
<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
<PrintStatus>NotSet</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>0</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</QueryResponse>
</IntuitResponse>
UI snapshot
Thanks

QBO API V3 : Product Inventory is not getting updated

We want to manually adjust/update the Inventory of an Item using QBO V3 API.
But, the QtyOnHand did not get updated on QBO properly. We re-checked using QBO browser app too.
First Request : Create a product of type "Inventory" on QBO with "QtyOnHand" set to 100.
a. The response appropriately mentioned that the product is created.
Second Request : Update the above product with "QtyOnHand" set to 200.
b. The response still contains the older QtyOnHand (100). It didn't reflect that new QtyOnHand.
How can we manually adjust / update QtyOnHand using QBO V3 API?
For reference, our update request is:
<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
<BatchItemRequest operation="update" bId="0">
<Item>
<Id>2091</Id>
<SyncToken>0</SyncToken>
<Name>Product 26--var 2</Name>
<Description>false</Description>
<Taxable>true</Taxable>
<UnitPrice>1000.00</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef>62</IncomeAccountRef>
<ExpenseAccountRef>111</ExpenseAccountRef>
<AssetAccountRef>112</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>200</QtyOnHand>
<InvStartDate>2014-01-21</InvStartDate>
</Item>
</BatchItemRequest>
</IntuitBatchRequest>
Our response XML is:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-01-20T23:21:44.559-08:00">
<BatchItemResponse bId="0">
<Item domain="QBO" sparse="false">
<Id>2091</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-01-20T22:44:10-08:00</CreateTime>
<LastUpdatedTime>2014-01-20T22:44:10-08:00</LastUpdatedTime>
</MetaData>
<Name>Product 26--var 2</Name>
<Description>false</Description>
<Active>true</Active>
<FullyQualifiedName>Product 26--var 2</FullyQualifiedName>
<Taxable>true</Taxable>
<UnitPrice>1000</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales">62</IncomeAccountRef>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">111</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">112</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>100</QtyOnHand>
<InvStartDate>2014-01-21</InvStartDate>
</Item>
</BatchItemResponse>
</IntuitResponse>
The QtyOnHand field is not an update-able field.
Inventory adjustments are made when:
You create a transaction that uses up inventory (Sales Receipts, Invoices, etc.)
You create a transaction that returns inventory (Credit Memos)
You issue an Inventory Adjustment (unfortunately, Intuit's API does not support this yet)
Given that the API does not support inventory adjustments yet, I don't think you'll be able to do what you're trying to do.