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,
    },
  ],
});