API Docs & Tools Blog Help
Voiding Invoice Objects - Intuit Developer Community Blog

April 6, 2016 | Priya Vijayakumar

Voiding Invoice Objects

QuickBooks Online supports the capability to void an invoice that was inadvertently created. That capability has now been extended to the REST APIs, the Invoice API now supports the void operation.
When an invoice is voided, Invoice is not deleted but the following fields are updated:

  • The Invoice Amounts and Quantities are zeroed
  • PrivateNote is marked as “Voided”
{
  "Invoice": {
    "Deposit": 0,
    "AllowIPNPayment": false,
    "AllowOnlinePayment": false,
    "AllowOnlineCreditCardPayment": false,
    "AllowOnlineACHPayment": false,
    "domain": "QBO",
    "sparse": false,
    "Id": "207",
    "SyncToken": "2",
    "MetaData": {
      "CreateTime": "2016-01-07T12:15:17-08:00",
      "LastUpdatedTime": "2016-03-29T14:15:04-07:00"
    },
    "CustomField": [
      {
        "DefinitionId": "1",
        "Name": "Crew #",
        "Type": "StringType"
      },
      {
        "DefinitionId": "2",
        "Name": "Test #",
        "Type": "StringType"
      }
    ],
    "DocNumber": "1067",
    "TxnDate": "2016-01-07",
    "CurrencyRef": {
      "value": "USD",
      "name": "United States Dollar"
    },
    "PrivateNote": "Voided",
    "LinkedTxn": [],
    "Line": [
      {
        "Id": "1",
        "LineNum": 1,
        "Amount": 0,
        "DetailType": "SalesItemLineDetail",
        "SalesItemLineDetail": {
          "ItemRef": {
            "value": "1",
            "name": "Services"
          },
          "TaxCodeRef": {
            "value": "NON"
          }
        }
      },
      {
        "Amount": 0,
        "DetailType": "SubTotalLineDetail",
        "SubTotalLineDetail": {}
      }
    ],
    "TxnTaxDetail": {
      "TotalTax": 0
    },
    "CustomerRef": {
      "value": "1",
      "name": "Amy"
    },
    "BillAddr": {
      "Id": "2",
      "Line1": "4581 Finch Lane St",
      "City": "Bayshore City",
      "CountrySubDivisionCode": "CA",
      "PostalCode": "943277",
      "Lat": "INVALID",
      "Long": "INVALID"
    },
    "ShipAddr": {
      "Id": "97",
      "Line1": "4581 Finch Lane St",
      "City": "Bayshore",
      "CountrySubDivisionCode": "CA",
      "PostalCode": "943277",
      "Lat": "INVALID",
      "Long": "INVALID"
    },
    "DueDate": "2016-02-06",
    "TotalAmt": 0,
    "ApplyTaxAfterDiscount": false,
    "PrintStatus": "NeedToPrint",
    "EmailStatus": "EmailSent",
    "BillEmail": {
      "Address": "priyan822@gmail.com"
    },
    "Balance": 0,
   "DeliveryInfo": {
      "DeliveryType": "Email",
      "DeliveryTime": "2016-03-24T14:14:03-07:00"
    }
  },
  "time": "2016-04-04T14:33:45.684-07:00"
}

A voided invoice cannot be used/linked in any other transactions. The API throws the following error message if a voided invoice is included in a transaction.

{
  "Fault": {
    "Error": [
      {
        "Message": "TxnID Cannot Be Linked",
        "Detail": "TxnID Cannot Be Linked : 207",
        "code": "620",
        "element": "Payment.Line.LinkedTxn.TxnId"
      }
    ],
    "type": "ValidationFault"
  },
  "time": "2016-03-29T15:30:21.009-07:00"
}

If the  voided invoice is included in a Payment, then the 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.

Comments

View all
Load more comments