Shane Hu
Shane Hu

Reputation: 1

Creating Sales Receipt with Sales Tax QBO API

I am trying to create a sales receipt with tax included. I understand that the SalesTaxCodeId/SalesTaxCodeName has not been implemented for the Quickbooks API v2, so I'm trying to directly add a tax rate through the field. Here is my request:

<SalesReceipt 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>
    <CustomerId idDomain="QBO">10</CustomerId>
    <TaxRate>5.00</TaxRate>
    <DepositToAccountId>52</DepositToAccountId>
</Header>
<Line>
    <Id>1</Id>
    <Desc>asdfdsafds</Desc>
    <Amount>500.00</Amount>
    <Taxable>true</Taxable>
    <ItemId idDomain="QBO">5</ItemId>
    <Qty>1</Qty>
    <AccountId>52</AccountId>
</Line>

However, I'm getting a rather cryptic error as a response.

<Message>You must select a product/service or an account for each split line with either an amount or a billable $$customer$$.</Message><ErrorCode>BAD_REQUEST</ErrorCode><Cause>-13012</Cause>

This error only occurs if the tax rate results in a non-zero tax amount. i.e. if the tax rate is non-zero and the line item is taxable, otherwise the request goes through fine. The error code does not exist in any documentation I can find and the error message is not all that helpful. Does anyone have any ideas on how to resolve this issue?

EDIT: updated itembyid response

<Id idDomain="QBO">5</Id>
<SyncToken>2<SyncToken>
<MetaData>
    <CreateTime>2013-06-07T15:07:29-07:00</CreateTime>     
    <LastUpdatedTime>2013-08-02T14:34:47-07:00</LastUpdatedTime>
</MetaData>
<Name>Clothes</Name>
<Taxable>true</Taxable>
<UnitPrice>
    <Amount>123</Amount>
</UnitPrice>
<IncomeAccountRef>
    <AccountId idDomain="QBO">1</AccountId>
</IncomeAccountRef>

Upvotes: 0

Views: 730

Answers (2)

nimisha shrivastava
nimisha shrivastava

Reputation: 2367

In your SalesReceipt request line, you are passing the
< AccountId >52 . The Line item does not support this tag. https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/salesreceipt

I think this might be the issue.

Upvotes: 1

Manas Mukherjee
Manas Mukherjee

Reputation: 5340

Can you check if the item with ID 5 exists in your account. You should also check the SalesTax settings.

[ QBO Account - 'Company' tab => Preferences ]

I tried with the same condition which you have mentioned above. i.e. [ if the tax rate is non-zero and the line item is taxable ] It worked fine. PFB details.

Request XML

<SalesReceipt 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>
    <CustomerId idDomain="QBO">3</CustomerId>
    <TaxRate>5.00</TaxRate>
    <DepositToAccountId>4</DepositToAccountId>
</Header>
<Line>
    <Id>1</Id>
    <Desc>asdfdsafds</Desc>
    <Amount>500.00</Amount>
    <Taxable>true</Taxable>
    <ItemId idDomain="QBO">1</ItemId>
    <Qty>1</Qty>
</Line>
</SalesReceipt>

Retrieve By ID

<SalesReceipt 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">75</Id>
  <SyncToken>0</SyncToken>
  <MetaData>
    <CreateTime>2013-08-02T22:10:41-07:00</CreateTime>
    <LastUpdatedTime>2013-08-02T22:10:41-07:00</LastUpdatedTime>
  </MetaData>
  <Header>
    <DocNumber>1038</DocNumber>
    <TxnDate>2013-08-02-07:00</TxnDate>
    <CustomerId idDomain="QBO">3</CustomerId>
    <SalesTaxCodeId idDomain="QBO">1</SalesTaxCodeId>
    <SalesTaxCodeName>IS_TAXABLE</SalesTaxCodeName>
    <SubTotalAmt>500.00</SubTotalAmt>
    <TaxRate>5</TaxRate>
    <TaxAmt>25.00</TaxAmt>
    <TotalAmt>525.00</TotalAmt>
    <ToBePrinted>false</ToBePrinted>
    <ToBeEmailed>false</ToBeEmailed>
    <ShipAddr>
      <Line1>Park Street</Line1>
      <City>Woodland Hills</City>
      <CountrySubDivisionCode>CA</CountrySubDivisionCode>
      <PostalCode>934657</PostalCode>
      <GeoCode>LAT=34.1785255,LNG=-118.597305</GeoCode>
      <Tag>CUSTOMER</Tag>
    </ShipAddr>
    <ShipMethodId idDomain="QBO" />
    <DepositToAccountId idDomain="QBO">4</DepositToAccountId>
    <DepositToAccountName>Undeposited Funds</DepositToAccountName>
    <DiscountTaxable>true</DiscountTaxable>
  </Header>
  <Line>
    <Id>1</Id>
    <Desc>asdfdsafds</Desc>
    <Amount>500.00</Amount>
    <Taxable>true</Taxable>
    <ItemId>1</ItemId>
    <Qty>1</Qty>
  </Line>
</SalesReceipt>

I'll also try to reproduce the exact error msg. If I get something, I'll update it here.

EDIT

GetById - (Item id - 1)

<Item 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">1</Id>
    <SyncToken>0</SyncToken>
    <MetaData>
        <CreateTime>2013-04-10T08:27:00-07:00</CreateTime>
        <LastUpdatedTime>2013-04-10T08:27:00-07:00</LastUpdatedTime>
    </MetaData>
    <Name>Services</Name>
    <Taxable>false</Taxable>
    <IncomeAccountRef>
        <AccountId idDomain="QBO">1</AccountId>
    </IncomeAccountRef>
</Item>

DocRef - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/item

Thanks

Upvotes: 1

Related Questions