Deleting Invoices and Bills Through the QuickBooks SDK
QuickBooks developers working with the SDK can remove transactions like invoices and bills using a dedicated transaction deletion request instead of list-item-only methods.
A common point of confusion for developers working with the QuickBooks SDK is how to remove transactions such as invoices and bills from a company file. While the SDK exposes a straightforward method for deleting list elements — customers, vendors, items, and accounts — the equivalent operation for transactions is less obvious, leaving some developers searching the documentation without success.
The Problem
Developers building integrations against the QuickBooks SDK (version 13 and related releases) sometimes hit a wall when they need to delete an invoice or bill programmatically. The SDK’s object model includes a list-deletion request that handles individual list entries, but there is no identically named or positioned method for transaction deletion. The result is that developers familiar with removing list items assume there is no transaction-level equivalent and abandon the task or resort to workarounds.
What Is Actually Happening
The QuickBooks SDK separates list operations from transaction operations throughout its request/response model. That separation is by design. List elements — the entities that populate QuickBooks’ Customer Center, Vendor Center, and Item List — are managed through one family of requests. Transactions — the day-to-day accounting records such as invoices, bills, payments, and journal entries — are managed through a different family. A developer who finds the list-deletion request and looks for a similarly named transaction-deletion request will not see one in the same location, because the transaction deletion request sits in its own branch of the request hierarchy.
The Accepted Solution
The formally accepted answer is to use a transaction deletion request — referred to in the SDK as TxnDel. This request is purpose-built for removing transactions from a company file and is the direct counterpart to the list-deletion request that developers already know.
To use it, a developer supplies two required pieces of information:
- Transaction deletion type — An enumerated value that tells QuickBooks what kind of transaction is being removed. The supported types span most of the transaction forms in QuickBooks, including invoices, bills, checks, credit memos, deposits, estimates, purchase orders, sales receipts, journal entries, and several others.
- Transaction ID — The unique internal identifier that QuickBooks assigned to the transaction when it was created. This is the same ID returned in the response when the transaction was originally added through the SDK.
How It Fits Together
The developer constructs a message set containing a transaction deletion request, sets the transaction type to the appropriate value (for example, “Invoice” or “Bill”), supplies the transaction ID of the record to remove, and sends the request to QuickBooks. QuickBooks processes the request, deletes the matching transaction, and returns a response indicating success or failure.
One important detail: the transaction ID must match an existing record in the currently open company file. If the ID is stale — for instance, if the transaction was already deleted through the QuickBooks interface — the request will fail. Developers building deletion workflows should capture and store the transaction ID at creation time or query for it beforehand so the correct record is targeted.
Supported Transaction Types
The transaction deletion request is not limited to invoices and bills. The same mechanism handles a wide range of QuickBooks transaction types, among them AR refund credit-card transactions, bill-payment checks, credit-card charges and credits, customer charges, inventory adjustments, item receipts, payroll-related adjustments, sales orders, sales-tax payment checks, time-tracking entries, inventory transfers, and vehicle-mileage records. This breadth means a single request structure can serve nearly any transaction-deletion need in an integration.
A Note on Deletion vs. Voiding
Developers should also be aware that deleting a transaction removes it entirely from the company file, as though it never existed. That is different from voiding a transaction, which preserves the record but zeroes out its amounts. For audit-trail integrity, QuickBooks users and accountants often prefer voiding over deletion, especially in periods that have already been closed. If the goal is simply to neutralize a transaction’s financial impact while keeping a record of it, the SDK offers a separate transaction-void request that mirrors the deletion request in structure but preserves the original entry.
For general QuickBooks troubleshooting and guidance beyond SDK development, QuickBooks Users covers common issues across both Desktop and Online editions.