简体   繁体   English

使用销售税QBO API创建销售收据

[英]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. 我知道Quickbooks API v2尚未实现SalesTaxCodeId / SalesTaxCodeName,所以我试图通过该字段直接添加税率。 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. 仅当税率导致非零税额时才会出现此错误。 ie 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 编辑:更新的itembyid响应

<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>

Can you check if the item with ID 5 exists in your account. 您可以查看帐户中是否存在ID为5的项目。 You should also check the SalesTax settings. 您还应该检查SalesTax设置。

[ QBO Account - 'Company' tab => Preferences ] [QBO帐户 - '公司'标签=>首选项]

I tried with the same condition which you have mentioned above. 我尝试过你上面提到的相同条件。 ie [ if the tax rate is non-zero and the line item is taxable ] It worked fine. 即[如果税率非零并且行项目应纳税]它工作正常。 PFB details. PFB细节。

Request XML 请求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 按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 ) 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 DocRef - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/item

Thanks 谢谢

In your SalesReceipt request line, you are passing the 在SalesReceipt请求行中,您将传递
< AccountId >52 . <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 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. 我认为这可能是个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM