{
  "TxnID": "ABC-1234567890",
  "TxnNumber": 123,
  "TxnDate": "2024-05-01",
  "DueDate": "2024-05-15",
  "TimeCreated": "2024-05-01T09:30:00+05:30",
  "TimeModified": "2024-05-01T09:30:00+05:30",
  "EditSequence": "9876543210",
  "VendorRef": {
    "ListID": "8000000A-1234567890",
    "FullName": "ACME Inc."
  },
  "APAccountRef": {
    "ListID": "8000000B-1234567890",
    "FullName": "Accounts Payable"
  },
  "LinkedTxn": {
    "TxnID": "XYZ-0987654321",
    "TxnType": "PurchaseOrder",
    "TxnDate": "2024-04-25",
    "RefNumber": "PO-12345",
    "LinkType": "QUANTYPE",
    "Amount": "0.00"
  },
  "AmountDue": "5000.00",
  "OpenAmount": "5000.00",
  "IsPaid": false,
  "ItemLineRet": [
    {
      "TxnLineID": "1A1-1234567890",
      "ItemRef": {
        "ListID": "8000000C-1234567890",
        "FullName": "Widget A"
      },
      "Quantity": 10,
      "Cost": "250.00",
      "Amount": "2500.00"
    },
    {
      "TxnLineID": "1A2-1234567890",
      "ItemRef": {
        "ListID": "8000000D-1234567890",
        "FullName": "Widget B"
      },
      "Quantity": 5,
      "Cost": "300.00",
      "Amount": "1500.00"
    },
    {
      "TxnLineID": "1A3-1234567890",
      "ItemRef": {
        "ListID": "8000000E-1234567890",
        "FullName": "Widget C"
      },
      "Quantity": 2,
      "Cost": "500.00",
      "Amount": "1000.00"
    }
  ]
}

A bill in QuickBooks Desktop is a record of a transaction that represents a request-for-payment from a vendor for goods or services that it has provided. Companies use bills to track the expenses they need to pay but have not yet paid. Bills are also known as payables.

To see all of the request parameters and response fields for , check out our client library’s amazing autocomplete.

Fetching bills

Each bill has one or multiple line items, which are the goods or services that the vendor is requesting payment for. The following example fetches all bills for a given EndUser, including the line items for each bill.

Fetching all bills with line items
const bills = await conductor.qbd.bill.fetchAll("{{END_USER_ID}}", {
  IncludeLineItems: true,
});

Creating bills

To create a bill in QuickBooks Desktop, you either need the identifiers (e.g., ListID) of the required associated objects, or you must create the associated objects first.

The following example uses mock data to create a bill in QuickBooks Desktop, which also requires creating a mock vendor, account, and service-item using the add() method of each object. The add() method returns the created object, which contains the ListID identifier to associate the objects with each other.

Creating a bill
const END_USER_ID = "{{END_USER_ID}}";
// Use unique names for mock objects because QBD requires each to be unique.
const UNIQUE_SUFFIX = Math.random().toFixed(6);

const vendor = await conductor.qbd.vendor.add(END_USER_ID, {
  Name: `Test Vendor ${UNIQUE_SUFFIX}`,
});

// A bill cannot be empty, so we must create an item to add to the bill,
// and every item requires an account, which we must create first.
const incomeAccount = await conductor.qbd.account.add(END_USER_ID, {
  Name: `Test Income Account ${UNIQUE_SUFFIX}`,
  AccountType: "Income",
});

// Create a service-item for the invoice with the account we just created.
const serviceItem = await conductor.qbd.itemService.add(END_USER_ID, {
  Name: `Construction Work ${UNIQUE_SUFFIX}`,
  SalesOrPurchase: {
    Price: "100.00",
    AccountRef: {
      ListID: incomeAccount.ListID,
    },
  },
});

const bill = await conductor.qbd.bill.add(END_USER_ID, {
  VendorRef: {
    ListID: vendor.ListID,
  },
  ItemLineAdd: [
    {
      ItemRef: {
        ListID: serviceItem.ListID,
      },
      Amount: "100.00",
      Quantity: 1,
    },
  ],
});