I'm trying to create invoices using the Java SDK (2.2.1) with the v3 API. My API calls to create invoices are failing because of a Business Validation Error
stating that my transaction line does not have a tax code associated with it (error code: 6000).
I'm trying to set the tax for the transaction (sales line) like this:
TaxLineDetail taxLineDetail = new TaxLineDetail();
taxLineDetail.setPercentBased(true);
taxLineDetail.setTaxPercent( getTaxPercent() );
salesLine.setTaxLineDetail(taxLineDetail);
I've also tried using Invoice#setTxnTaxDetail(TxnTaxDetail)
but it fails in both cases. It seems the API wants a tax code, presumably one that I set with:
TaxLineDetail#setTaxRateRef(ReferenceType)
But I don't understand where I get this tax rate code from. My QB account does have two taxes configured (23% and 0%) but how do I associate one of these with an invoice? Where is this (integer?) code that I need?
For what it's worth, this is a non-US account.
You can query TaxCode and TaxRate ref to get details and use the corresponding Ids in time of Invoice creation.
ApiExplorer - https://developer.intuit.com/apiexplorer?apiname=V3QBO#TaxCode
To get a correct XML structure of an Invoice object with TaxCode and TaxRate, you can create an invoice from QBO UI(with tax) and retrieve the same using API.
Thanks