使用QuickBooks Online v3 API(https://developer.intuit.com/apiexplorer?apiname=V3QBO)
如何创建付款,然后使用API Explorer将付款链接到现有发票?我正在使用沙箱进行所有测试。
例如,我在客户端下创建了一个付款,这是回复。
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T04:27:18.490-07:00">
<Payment domain="QBO" sparse="false">
<Id>162</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2015-04-23T04:28:55-07:00</CreateTime>
<LastUpdatedTime>2015-04-23T04:28:55-07:00</LastUpdatedTime>
</MetaData>
<TxnDate>2013-07-11</TxnDate>
<PrivateNote>Payment smoke test</PrivateNote>
<CustomerRef name="ZeanabArafat">61</CustomerRef>
<DepositToAccountRef>4</DepositToAccountRef>
<TotalAmt>200.00</TotalAmt>
<UnappliedAmt>200.00</UnappliedAmt>
<ProcessPayment>false</ProcessPayment>
</Payment>
</IntuitResponse>
我的付款是200美元。然后我创建了一张发票,以下是对此的响应......
然后我创建了一张发票,上面是我从API获得的回复。
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T05:25:26.668-07:00">
<Invoice domain="QBO" sparse="false">
<Id>163</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2015-04-23T05:26:58-07:00</CreateTime>
<LastUpdatedTime>2015-04-23T05:26:58-07:00</LastUpdatedTime>
</MetaData>
<CustomField>
<DefinitionId>1</DefinitionId>
<Name>Crew #</Name>
<Type>StringType</Type>
</CustomField>
<DocNumber>1049</DocNumber>
<TxnDate>2015-04-23</TxnDate>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Amount>2000.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Concrete">3</ItemRef>
<TaxCodeRef>NON</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>2000.00</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail />
</Line>
<TxnTaxDetail>
<TotalTax>0</TotalTax>
</TxnTaxDetail>
<CustomerRef name="ZeanabArafat">61</CustomerRef>
<BillAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</BillAddr>
<ShipAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</ShipAddr>
<DueDate>2015-05-23</DueDate>
<TotalAmt>2000.00</TotalAmt>
<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
<PrintStatus>NeedToPrint</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>2000.00</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</IntuitResponse>
然后我在API资源管理器中运行以下xml,用于发票上的更新命令,只是为了测试并确保它有效,然后我仔细检查了它确实更新了沙箱用户界面中发票的私人评论...所以...到目前为止一切顺利。
<Invoice xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="true">
<Id>163</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-10-15T14:13:24-07:00</CreateTime>
<LastUpdatedTime>2014-10-15T14:13:24-07:00</LastUpdatedTime>
</MetaData>
<PrivateNote>Invoice update Test</PrivateNote>
</Invoice>
所以这很有用。我收到了回复......
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T05:30:04.336-07:00">
<Invoice domain="QBO" sparse="false"> <Id>163</Id> <SyncToken>1</SyncToken> <MetaData> <CreateTime>2015-04-23T05:26:58-07:00</CreateTime> <LastUpdatedTime>2015-04-23T05:31:36-07:00</LastUpdatedTime> </MetaData> <CustomField> <DefinitionId>1</DefinitionId> <Name>Crew #</Name> <Type>StringType</Type> </CustomField> <DocNumber>1049</DocNumber> <TxnDate>2015-04-23</TxnDate> <PrivateNote>Invoice update Test</PrivateNote> <Line> <Id>1</Id> <LineNum>1</LineNum> <Amount>2000.00</Amount> <DetailType>SalesItemLineDetail</DetailType> <SalesItemLineDetail> <ItemRef name="Concrete">3</ItemRef> <TaxCodeRef>NON</TaxCodeRef> </SalesItemLineDetail> </Line> <Line> <Amount>2000.00</Amount> <DetailType>SubTotalLineDetail</DetailType> <SubTotalLineDetail /> </Line> <TxnTaxDetail> <TotalTax>0</TotalTax> </TxnTaxDetail> <CustomerRef name="ZeanabArafat">61</CustomerRef> <BillAddr> <Id>98</Id> <Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1> <Lat>28.522938</Lat> <Long>-81.605711</Long> </BillAddr> <ShipAddr> <Id>98</Id> <Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1> <Lat>28.522938</Lat> <Long>-81.605711</Long> </ShipAddr> <DueDate>2015-05-23</DueDate> <TotalAmt>2000.00</TotalAmt> <ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount> <PrintStatus>NeedToPrint</PrintStatus> <EmailStatus>NotSet</EmailStatus> <Balance>2000.00</Balance> <Deposit>0</Deposit> <AllowIPNPayment>false</AllowIPNPayment> <AllowOnlinePayment>false</AllowOnlinePayment> <AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment> <AllowOnlineACHPayment>false</AllowOnlineACHPayment> </Invoice> </IntuitResponse>
正如我所说,在沙盒UI中我确实看到了结果。我在私人评论中看到我的文字。 (或声明备忘录区域)
现在我的问题:尝试将付款链接到交易。
根据文档和我的一些猜测工作,我假设我必须为发票更新UPDATE,我需要为客户端提供customerRef,将SyncToken更新为'1',并提供linkedtransaction xml I将发布我试图做的事情,这样你就可以告诉我我做错了什么。请记住我的付款ID是162,我认为这是TxnId的含义?
所以我这次尝试链接事务的新XML命令是......
<Invoice xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="true">
<Id>163</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2014-10-15T14:13:24-07:00</CreateTime>
<LastUpdatedTime>2014-10-15T14:13:24-07:00</LastUpdatedTime>
</MetaData>
<PrivateNote>Invoice update Test</PrivateNote>
<LinkedTxn>
<TxnId>162</TxnId>
<TxnType>Payment</TxnType>
</LinkedTxn>
</Invoice>
这返回了以下回复......
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T05:40:03.383-07:00">
<Invoice domain="QBO" sparse="false">
<Id>163</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2015-04-23T05:26:58-07:00</CreateTime>
<LastUpdatedTime>2015-04-23T05:31:36-07:00</LastUpdatedTime>
</MetaData>
<CustomField>
<DefinitionId>1</DefinitionId>
<Name>Crew #</Name>
<Type>StringType</Type>
</CustomField>
<DocNumber>1049</DocNumber>
<TxnDate>2015-04-23</TxnDate>
<PrivateNote>Invoice update Test</PrivateNote>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Amount>2000.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Concrete">3</ItemRef>
<TaxCodeRef>NON</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>2000.00</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail />
</Line>
<TxnTaxDetail>
<TotalTax>0</TotalTax>
</TxnTaxDetail>
<CustomerRef name="ZeanabArafat">61</CustomerRef>
<BillAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</BillAddr>
<ShipAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</ShipAddr>
<DueDate>2015-05-23</DueDate>
<TotalAmt>2000.00</TotalAmt>
<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
<PrintStatus>NeedToPrint</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>2000.00</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</IntuitResponse>
所以看起来它没有错误......但是当我去检查沙箱UI以查看它是否已连接?我没有看到任何东西,没有交易状态,也没有变更发票?
我做错了什么?我错过了一步吗?
答案 0 :(得分:0)
我找到了答案,诀窍是先创建发票然后通过付款引用发票。我是按照错误的顺序做的,在与直觉的主持人交谈后,我确认这是一个错误。
使用类似的内容将付款链接到发票
<Payment xmlns="http://schema.intuit.com/finance/v3">
<CustomerRef name="Customer Name Here">61</CustomerRef>
<TotalAmt>500</TotalAmt>
<Line>
<Amount>500</Amount>
<LinkedTxn>
<TxnId>164</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
</Payment>
TxnID是发票ID,请确保金额和总金额排队!