Manage linked transactions
QuickBooks relates a sales or purchase transaction with its supporting transactions via the linked transaction mechanism. For example, a payment applied to a given invoice is considered a linked transaction to that invoice.
This tutorial shows how the QuickBooks Online API uses linked transactions and what information they supply to an Invoice object. It also explains what impact a linked transaction has on QuickBooks company accounts and how a customer’s payment maps to linked transactions in the accounting model.
To follow along, you’ll need a sandbox or another QuickBooks company populated with a chart of accounts, customers, invoices, and payments.
Linked transaction summary
A linked transaction is realized in the QuickBooks Online API with the LinkedTxn
element. The example below shows an Invoice object (Id=147) with a linked transaction to its corresponding Payment object (Id=190) via the LinkedTxn
element. Some content has been omitted in order to showcase the linked transaction.
The linked transaction element provides the type and ID of the object. In order to get the complete details of the linked transaction, you must traverse the link to retrieve the object. For example, to retrieve the the linked transaction for the Invoice object above, where LinkedTxn.TxnType=Payment
and LinkedTxn.TxnId=190
, issue a request similar to the following:
| https://quickbooks.api.intuit.com/v3/company/1386066315/payment/190
|
The table below lists all transactions that support linked transactions, along with the type of linked transactions.
TRANSACTION |
SUPPORTED LINKEDTXN.TXNTYPE |
COMMENTS |
Bill |
BillPaymentCheck |
- Establish the Bill/BillPayment relationship through the
BillPayment object.
- Read only; set by QuickBooks services when link has been established from the
BillPayment object.
- Returned in
Bill.LinkedTxn element.
|
Bill |
PurchaseOrder |
- Establish the Bill/PurchaseOrder relationship through the
Bill object. Multiple Purchase Orders can be linked to Bill.
- Create, read, and update operations are supported.
|
BillPayment |
Bill VendorCredit JournalEntry Deposit |
- One or more line-level links established with the
BillPayment.Line.LinkedTxn element.
- Create, read, and update operations are supported.
|
Deposit |
Transfer Payment SalesReceipt JournalEntry BillPayment |
- One or more line-level links established with the
Deposit.Line.LinkedTxn element
- Create, read, and update operations are supported.
|
Estimate |
Invoice |
- One or more transaction-level links established with the
Estimate.LinkedTxn element.
- Only one link can be made to per
Estimate . Progress Invoicing is not supported via the API.
- Create, read, and update operations are supported.
|
Invoice |
Estimate TimeActivity |
- One or more transaction-level links established with the
Invoice.LinkedTxn element.
- Create, read, and update operations are supported.
|
Invoice |
Payment |
- Establish the Invoice/Payment relationship through the
Payment object.
- Read only; set by QuickBooks services when link has been established from the
Payment object.
- Returned in the
Invoice.LinkedTxn element.
|
Invoice |
ChargeCredit StatementCharge |
- The
ReimburseCharge , ChargeCredit , or StatementCharge transaction resources are not supported by the QuickBooks
Online API, so you cannot get details about these.
- Read only; set in the QuickBooks company file via the UI.
- Returned in
Invoice.LinkedTxn element.
|
Invoice |
ReimburseCharge |
- Details about a
ReimburseCharge transaction are returned in Invoice.Line.SalesItemLineDetail . See Notes about linked
transactions in invoice objects for more information.
- Read only; set in the QuickBooks company file via the UI.
- Returned in
Invoice.LinkedTxn element.
|
Payment |
Invoice Expense CreditMemo Check CreditCardCredit JournalEntry |
|
PurchaseOrder |
Bill |
- One or more transaction-level links established with the
PurchaseOrder.LinkedTxn element.
- Read-only; establish the PurchaseOrder/Bill relationship via the UI.
|
JournalEntry |
BillPayment |
- One or more transaction-level links established with the
JournalEntry.LinkedTxn element.
- Create, read, and update operations are supported.
|
VendorCredit |
BillPayment |
- One or more transaction-level links established with the
VendorCredit.LinkedTxn element.
- Create, read, and update operations are supported.
|
Notes about linked transactions in invoice objects
The Invoice object returns linked transaction information in the Invoice.LinkedTxn
array element. Two types of relationships are supported:
- Read-only links representing how it is paid, having a direct effect on the company’s accounts.
- The
ReimburseCharge
, ChargeCredit
, StatementCharge
, or Payment
objects can establish relationships to the Invoice object. Of these, the QuickBooks Online API supports the Payment
relationship, only. See Notes about linked transactions in payment objects, below. The other relationships must be established and
managed though the UI.
- For these relationships, the
Invoice.LinkedTxn
elements are read-only on the Invoice side.
- Read-write links representing supporting information for the invoice. They don’t affect company accounts.
- The Invoice object can create, update, and delete relationships to
TimeActivity
and Estimate
objects.
Reimbursable charges
A reimbursable charge corresponds to an expense incurred on behalf of a customer for which the amount needs to be invoiced. This relationship is established in the QuickBooks UI and is read-only through the API. Details for a reimbursable charge are sent in the Invoice object via the Line.SalesItemLineDetail
as follows
Line.SalesItemLineDetail.ItemRef
: the id of the item object for the billable expense. If the expense does not correspond to an item in the company’s product and services list, this is set to 1.
Line.SalesItemLineDetail.ItemAccountRef
: the account associated with the reimbursable expense.
Line.SalesItemLineDetail.MarkupInfo.MarkupAccountRef
: the account associated with the markup expense.
In addition, ReimbursedCharge
is returned in the Invoice.LinkedTxn
element of the invoice object.
Linked transactions with voided invoices
When an invoice is voided, either via the UI or QuickBooks Online API, the following operations are performed automatically by the underlying QuickBooks service.
- All amounts and quantities in the Invoice object are zeroed.
- Each
Invoice.LinkedTxn
link is cleared.
- Each Payment object is reset to its unapplied state:
- The voided payment amount is added back to the
Payment.UnappliedAmt
attribute.
- The
Payment.Line.LinkedTxn
elements related to the voided invoice are cleared.
See Invoice in the QuickBooks Online API Reference for specific details on how to void an invoice.
Notes about linked transactions in payment objects
A Payment object represents funds collected from a customer, with a breakdown of how the funds are applied. The breakdown is a list of lines, with each item in the list represented by a Line.LinkedTxn
element. The table below lists the possible type of linked transactions supported by Payment objects, with guidance on how to create them.
LINKEDTXN.TXNTYPE |
NOTES |
Invoice |
- Create directly via QuickBooks Online UI or API.
Payment.Line.LinkedTxn.TxnType is set to Invoice.
- To get details of the linked
Invoice object, read/query on Invoice resource, using value stored in Payment.Line.LinkedTxn.TxnId for Invoice.Id .
- Create/update operations on
Invoice resource supported via API.
|
CreditMemo |
- Create directly via QuickBooks Online UI or API.
Payment.Line.LinkedTxn.TxnType is set to CreditMemo.
- To get details of the linked
CreditMemo object, read/query on CreditMemo resource, using value stored in Payment.Line.LinkedTxn.TxnId for CreditMemo.Id .
- Create/update operations on
Creditmemo resource supported via API.
|
Expense |
- Create directly as an Expense object via the QuickBooks Online UI:
- Set ACCOUNT to Accounts Receivable.
- Set AMOUNT to the expense amount.
- Set CUSTOMER to the customer on whose behalf the expense occurred.
Payment.Line.LinkedTxn.TxnType is set to Expense ; underlying API stores it as a Purchase object.
- Create directly as a
Purchase object via the QuickBooks Online API. Then, to create the linked transaction:
- Set
Payment.Line.LinkedTxn.TxnType to Expense .
- Set
Payment.Line.LinkedTxn.TxnId to Purchase.Id .
- To get details of the linked
Expense , read/query on Purchase resource, using value stored in Payment.Line.LinkedTxn.TxnId for Purchase.Id .
|
Check |
- Create directly as a Check object via the QuickBooks UI:
- Set ACCOUNT to Accounts Receivable.
- Set AMOUNT to the expense amount.
- Set CUSTOMER to the customer on whose behalf the expense occurred.
Payment.Line.LinkedTxn.TxnType is set to Check ; underlying API stores it as a Purchase object.
- Create/update operations on
Check resource not supported via API.
- To get details of the linked
Check , read/query on Purchase resource, using value stored in Line.LinkedTxn.TxnId for Purchase.Id .
|
CreditCardCredit |
- Create directly as a CreditCardCredit object via the QuickBooks UI:
- Set ACCOUNT to Accounts Receivable.
- Set AMOUNT to the expense amount.
- Set CUSTOMER to the customer on whose behalf the credit occurred.
Payment.Line.LinkedTxn.TxnType is set to CreditCardCredit ; underlying API stores it as a Purchase object.
- Create/update operations on
CreditCardCredit resource not supported via API.
- To get details of the linked
CreditCardCredit , read/query on Purchase resource, using value stored in Line.LinkedTxn.TxnId for Purchase.Id .
|
JournalEntry |
- Create directly as a JournalEntry object via QuickBooks Online UI or API on the credit-side line (
JournalEntry.Line.JournalEntryLineDetail.PostingType=Credit ).
- Set ACCOUNT to Accounts Receivable.
- Set AMOUNT to the expense amount.
- Set CUSTOMER to the customer on whose behalf the expense occurred.
Payment.Line.LinkedTxn.TxnType is set to JournalEntry.
- To get details of the linked
JournalEntry object, read/query on JournalEntry resource, using value stored in Payment.Line.LinkedTxn.TxnId for JournalEntry.Id .
- Create/update operations on
JournalEntry resource supported via API.
|
Notes about linked transactions in expense objects
An expense object represents the purchases made from a vendor or customer. The breakdown is a list of lines, with each item in the list represented by a Line.LinkedTxn
element. The table below lists the possible type of linked transactions supported by Expense objects, with guidance on how to create them.
LINKEDTXN.TXNTYPE |
NOTES |
BillPayment |
- Create directly via QuickBooks Online UI or API.
- One or more line-level links established with the
BillPayment.Line.LinkedTxn element for the following entities: Bill ,``Deposit``,``JournalEntry`` and VendorCredit .
- For Vendor entity, set ACCOUNT to
Accounts Payable (A/P) so that we can have both credit and debit.
- For Deposit entity, set ACCOUNT to
Accounts Payable (A/P) .
|
JournalEntry |
- One or more transaction-level links established with the
JournalEntry.LinkedTxn element for BillPayment.
|
VendorCredit90[ki8] |
- One or more transaction-level links established with the
VendorCredit.LinkedTxn element for BillPayment.
|
PurchaseOrder |
- One or more transaction-level links established with the
PurchaseOrder.LinkedTxn element for Bill.
|
Bill |
- One or more transaction-level and line level links established with the
Bill.Line.LinkedTxn and Bill.LinkedTxn element for PurchaseOrder.
- For
Create scenario, Line.Id and Line.LineNum should not be present.
- For
PurchaseOrder entity, Line.LinkedTxn.TxnLineId is a mandatory field.
|