Quickbooks API Explorer - How To Link Transactions To Invoices? - quickbooks-online

Using the QuickBooks Online v3 API (https://developer.intuit.com/apiexplorer?apiname=V3QBO)
How do I create a payment and then link that payment to an existing invoice using the API Explorer? I'm using sandbox for all my testing.
For example, I created a payment under a client and here is the response.
<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>
My payment was for $200. I then created an invoice, here is the response from that...
I then created an invoice the response I got from API below.
<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>
I then run the following xml in API explorer for the update command on the invoice just to test and be sure it works and then I double checked and it did update the private comments for the invoice in the UI of sandbox... so ...so far so good.
<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>
So this worked. I got the response...
<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>
as I said looking in the sandbox UI I did see the results. I see in the private comments my text that I put. (or statement memo area)
Now for my problem: Trying to link the payment to the transaction.
According to the documentation and some guess work on my part I assume I got to go to UPDATE for the invoice and I need to supply my customerRef for the client, update the SyncToken by '1', and supply the linkedtransaction xml I will post what I tried to do so you can tell me what I did wrong. Keep in mind my payment ID was 162, I assume this is what is meant by TxnId?
So my new XML command to try and link the transaction this time is...
<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>
This returned the following response...
<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>
So looks like it worked no errors... but when I go to check the sandbox UI to see if its connected? I don't see anything, no status for the transaction and no change on the invoice?
What did I do wrong? Am I missing a step?

I found the answer, trick is to create invoices first then reference the invoice via payments. I was doing in the incorrect order, and after talking to the moderators of intuit I confirmed it was a bug.
Use something like this to link the payment to the invoice
<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 is the invoice ID, make sure the amount and total amount line up!

Related

Implementing Sage Intacct API via Postman

I would like to get the invoice link from the purchase order implementing Sage Intacct API via Postman.
I suppose it can be done by following sequences(or by only one api request? not sure about this).
Order a purchase
Create a purchase receipt
Get an invoice link from it
Please refer to this API document (https://developer.intacct.com/api).
i.e. This is the body of a request to create a purchase transaction.
<?xml version="1.0" encoding="UTF-8"?>
<request>
<control>
<senderid>{{sender_id}}</senderid>
<password>{{sender_password}}</password>
<controlid>{{$timestamp}}</controlid>
<uniqueid>false</uniqueid>
<dtdversion>3.0</dtdversion>
<includewhitespace>false</includewhitespace>
</control>
<operation>
<authentication>
<sessionid>{{temp_session_id}}</sessionid>
</authentication>
<content>
<function controlid="{{$guid}}">
<create_potransaction>
<transactiontype>Purchase Requisition</transactiontype>
<datecreated>
<year>2013</year>
<month>6</month>
<day>19</day>
</datecreated>
<vendorid>1001</vendorid>
<referenceno>1234</referenceno>
<vendordocno>vendordocno001</vendordocno>
<datedue>
<year>2013</year>
<month>6</month>
<day>20</day>
</datedue>
<payto>
<contactname>Jameson Company</contactname>
</payto>
<exchratetype>Intacct Daily Rate</exchratetype>
<customfields/>
<potransitems>
<potransitem>
<itemid>75300GL</itemid>
<quantity>100</quantity>
<unit>Each</unit>
<price>1</price>
<locationid>MGMT-US</locationid>
<departmentid>IT</departmentid>
</potransitem>
</potransitems>
</create_potransaction>
</function>
</content>
</operation>
</request>
Thank you in advance.
You can download the Postman collection file (API) from the developer docs.
And then just refer to Purchasing/Purchasing Transactions/Create Transaction (Legacy).
You can change the body (SOAP) content.
I'm sure you can manage it.

MAGENTO - Add data to custom module

i am new in magento, i am developing a custom module to save some information for every logged client, but my problem is: i cant add data to my table, so this is what i already did:
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Desing_ControlApp>
<version>0.1.0</version>
</Desing_ControlApp>
</modules>
<global>
<models>
<Desing_ControlApp>
<class>Desing_ControlApp_Model</class>
<resourceModel>Desing_ControlApp_mysql4</resourceModel>
</Desing_ControlApp>
<Desing_ControlApp_mysql4>
<class>Desing_ControlApp_Model_Mysql4</class>
<entities>
<Desing_ControlApp>
<table>Desing_ControlApp</table>
</Desing_ControlApp>
</entities>
</Desing_ControlApp_mysql4>
</models>
<helpers>
<controlapp>
<class>Desing_ControlApp_Helper</class>
</controlapp>
</helpers>
<blocks>
<controlapp>
<class>Desing_ControlApp_Block</class>
</controlapp>
</blocks>
<resources>
<controlapp_setup>
<setup>
<module>Desing_ControlApp</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</controlapp_setup>
<controlapp_write>
<connection>
<use>core_write</use>
</connection>
</controlapp_write>
<controlapp_read>
<connection>
<use>core_read</use>
</connection>
</controlapp_read>
</resources>
<events>
<controller_action_layout_load_before>
<observers>
<Desing_ControlApp>
<class>Desing_ControlApp/Observer</class>
<method>verificarApp</method>
</Desing_ControlApp>
</observers>
</controller_action_layout_load_before>
</events>
</global>
<admin>
<routers>
<controlapp>
<use>admin</use>
<args>
<module>Desing_ControlApp</module>
<frontName>admin_controlapp</frontName>
</args>
</controlapp>
</routers>
</admin>
<adminhtml>
<menu>
<controlapp module="controlapp">
<title>ControlApp</title>
<sort_order>100</sort_order>
<children>
<controlappbackend module="controlapp">
<title>GENERAL CODE</title>
<sort_order>0</sort_order>
<action>admin_controlapp/adminhtml_controlappbackend</action>
</controlappbackend>
</children>
</controlapp>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<controlapp translate="title" module="controlapp">
<title>ControlApp</title>
<sort_order>1000</sort_order>
<children>
<controlappbackend translate="title">
<title>GENERAL CODE</title>
</controlappbackend>
</children>
</controlapp>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<controlapp>
<file>controlapp.xml</file>
</controlapp>
</updates>
</layout>
</adminhtml>
</config>
i add the table here in mysql4_install-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$sql=<<<SQLTEXT
create table desinglog(
log_id int not null auto_increment,
cliente_id smallint(8) unsigned default '0',
token varchar(255) default'0',
user varchar(255) default'0',
primary key(log_id));
SQLTEXT;
$installer->run($sql);
//demo
//Mage::getModel('core/url_rewrite')->setId(null);
//demo
$installer->endSetup();
so i have an observer and i want to insert data from there, i fonud a snipet to do it whith
$model = Mage::getModel('Desing_ControlApp/Desing_ControlApp')->....
but i cant access, every time the page show me "page is not working", so what i have to use instead Desing_ControlApp/Desing_ControlApp or i miss to write something? i cant found a good tutorial about these to. i found something here https://magento.stackexchange.com/questions/9863/magento-connect-to-database-from-a-module but no results.
"i cant add data to my table" - the problem was table name is mismatching, you didn't call correct table name in config.
in Config <table>Desing_ControlApp</table>
<entities>
<Desing_ControlApp>
<table>Desing_ControlApp</table><!-- table name mismatch-->
</Desing_ControlApp>
</entities>
but in setup file mysql4_install-0.1.0.php create table desinglog(
now change the config to call correct table then clear cache

Different loops in tsung

Could someone please advise me what's the main difference between loops like for and <load loop="">?
I've figured out strange behavior.
I have the config file:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" dumptraffic="true" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="1"/>
</clients>
<servers>
<server host="example.com" port="443" type="ssl"/>
</servers>
<load loop="100" duration="2" unit="minute">
<arrivalphase phase="1" duration="1" unit="second">
<users maxnumber="1" arrivalrate="1" unit="second"/>
</arrivalphase>
</load>
<sessions>
<session name="one" type="ts_http" probability="100">
<request>
<http url='/Service.asmx' version='1.0' contents_from_file="/home/user/file.xml" content_type='text/xml; charset=UTF-8' method='POST'>
<soap action="Retrieve"/>
</http>
</request>
</session>
</sessions>
</tsung>`
It produces about 1900 requests during the load process.
But if I remove the attribute loop="100" from the <load> tag and add the for loop the number of requests decreases to 70 requests. In this case the config file looks like so:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" dumptraffic="true" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="1"/>
</clients>
<servers>
<server host="example.com" port="443" type="ssl"/>
</servers>
<load duration="2" unit="minute">
<arrivalphase phase="1" duration="1" unit="second">
<users maxnumber="1" arrivalrate="1" unit="second"/>
</arrivalphase>
</load>
<sessions>
<session name="one" type="ts_http" probability="100">
<for var="counter" from="1" to="100" incr="1">
<request>
<http url='/Service.asmx' version='1.0' contents_from_file="/home/user/file.xml" content_type='text/xml; charset=UTF-8' method='POST'>
<soap action="Retrieve"/>
</http>
</request>
</for>
</session>
</sessions>
</tsung>
Besides it creates 61 sessions, though the <client maxusers="1"/> and <users maxnumber="1"/> attributes doesn't change. Here's the screenshot of both reports: enter link description here
Why does it work in different ways? Logically they should work identically, just repeat the sequence of requests.
Loop on load section will generate new users, so new sessions, cookies and all users related. Loop inside a session will re-use same users.

apply payments to specific quickbooks invoice using Ruby Gem

Our ruby gem creates invoices in quickbooks, and then creates payments for the same amount and date. How do we have the payment apply to the invoice? (quickbooks online)
Please refer Payment doc.
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/payment
It will be through Line( and linkedTran ) attribute.
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/0700_other_topics#Line
Ex -
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-07-18T09:52:33.800-07:00">
<QueryResponse startPosition="1" maxResults="1">
<Payment domain="QBO" sparse="false">
<Id>6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-07-18T09:51:59-07:00</CreateTime>
<LastUpdatedTime>2014-07-18T09:51:59-07:00</LastUpdatedTime>
</MetaData>
<TxnDate>2014-07-18</TxnDate>
<CurrencyRef name="United States Dollar">USD</CurrencyRef>
<Line>
<Amount>300.00</Amount>
<LinkedTxn>
<TxnId>1</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
<CustomerRef name="Anna Ellixson">2</CustomerRef>
<DepositToAccountRef>4</DepositToAccountRef>
<TotalAmt>300.00</TotalAmt>
<UnappliedAmt>0</UnappliedAmt>
<ProcessPayment>false</ProcessPayment>
</Payment>
</QueryResponse>
</IntuitResponse>
To get the correct object structure, create an invoice in QB UI and corresponding Payment and then retrieve the Payment Object using getById(Payment) endpoint.
You can try this from ApiExplorer.
https://developer.intuit.com/apiexplorer?apiname=V3QBO
Thanks

Amazon MWS update product using _POST_PRODUCT_DATA_ / Product feed

I want to update the ShippingWeight in some of our products.
I think the Product feed should do this for me.
The feed below seems to work fine, the data is updated in amazon, but I get an error response.
What's wrong with the feed, why do I get an error response even though the updates are done ?
I tried Update and PartialUpdate.
The error response looks like an error on creating new products.
And why do I have to specify the "Title" element when updating the ShippingWeight (Title does not have minOccurs="0" in xsd) :-(
Here's my feed:
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.02</DocumentVersion>
<MerchantIdentifier>xxxx</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<Message>
<MessageID>1375606841671</MessageID>
<OperationType>PartialUpdate</OperationType>
<Product>
<SKU>1894</SKU>
<DescriptionData>
<Title><![CDATA[abcdefghi....]]></Title>
<ItemDimensions>
<Length unitOfMeasure="CM">44.0</Length>
<Width unitOfMeasure="CM">33.0</Width>
<Height unitOfMeasure="CM">42.0</Height>
<Weight unitOfMeasure="GR">1030.0</Weight>
</ItemDimensions>
<ShippingWeight unitOfMeasure="GR">1040.0</ShippingWeight>
</DescriptionData>
</Product>
</Message>
Here's amazon's response:
<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.02</DocumentVersion>
<MerchantIdentifier>xxxxxx</MerchantIdentifier>
</Header>
<MessageType>ProcessingReport</MessageType>
<Message>
<MessageID>1</MessageID>
<ProcessingReport>
<DocumentTransactionID>yyyyy</DocumentTransactionID>
<StatusCode>Complete</StatusCode>
<ProcessingSummary>
<MessagesProcessed>1</MessagesProcessed>
<MessagesSuccessful>0</MessagesSuccessful>
<MessagesWithError>1</MessagesWithError>
<MessagesWithWarning>0</MessagesWithWarning>
</ProcessingSummary>
<Result>
<MessageID>1375606841671</MessageID>
<ResultCode>Error</ResultCode>
<ResultMessageCode>8560</ResultMessageCode>
<ResultDescription>SKU 1894, Fehlende Attribute product_type. SKU 1894 keine eindeutige ASIN gefunden. Zur Erstellung einer neuen ASIN fehlen noch folgende Attribute: product_type. Feed ID: 0. Weitere Informationen dazu http://sellercentral.amazon.de/gp/errorcode/200692370</ResultDescription>
<AdditionalInfo>
<SKU>1894</SKU>
</AdditionalInfo>
</Result>
</ProcessingReport>
</Message>
Thanx a lot in advance.
You have a bad SKU number. You can not send in request fiction SKU number. I found some and tried to use RO7WA11930KB1CA1A - hat.

Resources