quickbooks-node-promise
v3.3.11
Published
Connect to QuickBooks Online API with OAuth 2 with typescript on entities
Downloads
847
Maintainers
Readme
Overview
This library was created for Quickbooks OAuth2. It simplifies the OAuth process and renewing of the access token when it is about to expire. This can be turned off in the AppConfig. It also simplifies the process of making requests to Quickbooks. It has typescript types for all the requests and responses.
Example grabbing a customer from Quickbooks
const QuickBooks = require("quickbooks-node-promise");
const qbo = new QuickBooks(appConfig, realmID);
const customers = await qbo.findCustomers({ Id: "1234" });
const customer = customer.QueryResponse.Customer[0];
console.log(`Hi my customer's name is ${customer.Name}`);
Fully typed using documentation
Typescript types were scrapped from the Quickbooks documentation. The types may not be perfect at the moment due to quickbooks documentation not being perfect. If you find any issues, please create an issue on github.
Setup
Check the example for node express setup endpoints
Install
npm i quickbooks-node-promise
Config setup
A config setup is needed for each instance. The minimum needed is supplying the instance with a store method properties which are explained later. The appKey
and appSecret
are required to create, refresh, and revoke tokens. To create a token the redirectUrl
and scope
fields are also required. Use the authorizeUrl
method to generate an OAuth link. More on the OAuth process later. The useProduction
field is false by default so for production enviroment you must supply true
for this.
A very basic example using internal store. This example will not autoRefresh the token and cannot be used to manage token information such as revoking a token.
const appConfig: AppConfig = {
autoRefresh: false,
accessToken: '123'
};
const qbo = new Quickbooks(appConfig, realmID);
const customers = await qbo.findCustomers({ Id: "1234" });
A more advanced example using a Function Store. When the accessToken expires, it will automatically refresh the accessToken. You should change getToken and saveToken to use a database or some other storage method.
const realms = {};
// QB config
const QBAppconfig = {
appKey: QB_APP_KEY,
appSecret: QB_APP_SECRET,
redirectUrl: QB_REDIRECT_URL,
scope: [
Quickbooks.scopes.Accounting,
Quickbooks.scopes.OpenId,
Quickbooks.scopes.Profile,
Quickbooks.scopes.Email,
Quickbooks.scopes.Phone,
Quickbooks.scopes.Address,
],
getToken(realmId, appConfig) {
return Promise.resolve(realms[realmId]);
},
saveToken(realmId, tokenData, appConfig, extra) {
realms[realmId] = saveTokenData;
return Promise.resolve(saveTokenData);
},
};
| Property | Type | Description | | --- | --- | --- | | appKey | string | Required for token management such as creating, refreshing or revoking tokens. not needed if supplying a token and just need to hit normal endpoints | | appSecret | string | Required for token management such as creating, refreshing or revoking tokens. not needed if supplying a token and just need to hit normal endpoints | | redirectUrl | string | Required if using Oauth flow. Must be the same as the url put on the quickbooks developer portal | | scope | string[] | Required if using Oauth flow. Available scopes detailed below | | minorversion | number | null for latest version | | webhookVerifierToken | string | Used for verifying the webhook | | useProduction | string | default is false, determines weather to use production or sandbox url | | debug | boolean | default is false, if true will console log all requests and responses. | | state | string | CSRF Token, used to prevent CSRF attacks. If not supplied, one will be generated for you. Can optionally be supplied in the authorizeUrl method. Used to compare with the state returned from the OAuth process. | | autoRefresh | boolean | default is true, will auto refresh auth token if about to expire and the appKey and appSecret are supplied | | autoRefreshBufferSeconds | number | defualt is 60 seconds, number of seconds before token expires that will trigger to get a new token |
Scopes available:
Quickbooks.scopes = {
Accounting: "com.intuit.quickbooks.accounting",
Payment: "com.intuit.quickbooks.payment",
Payroll: "com.intuit.quickbooks.payroll",
TimeTracking: "com.intuit.quickbooks.payroll.timetracking",
Benefits: "com.intuit.quickbooks.payroll.benefits",
Profile: "profile",
Email: "email",
Phone: "phone",
Address: "address",
OpenId: "openid",
Intuit_name: "intuit_name",
};
Create Store
The store is how the token information is saved and retrieved. There are 3 different ways to create a store. Internal, Class and Functions. Only one method can be used at a time. If more than one method is being used, an error will be thrown.
The Internal Method
The internal method is used if you are managing the OAuth process and token information yourself. by setting autoRefresh
to false
and supplying the accessToken
you can use all of the instance methods to access quickbooks. You will not be able to create, refresh or revoke tokens. If you add the optional refreshToken
you can use the refreshAccessToken
method to refresh the token and can set autoRefresh
to true
to auto refresh the token. autoRefresh
requires appKey
and appSecret
.
If you do not supply an accessToken, you must supply the appKey
, appSecret
, refreshUrl
and scope
to create, refresh or revoke tokens. If no other store properties are given, this is the method chosen.
// QB config
const QBAppconfig = {
autoRefresh: false,
accessToken: '123',
};
// QB config
const QBAppconfig = {
appKey: QB_APP_KEY,
appSecret: QB_APP_SECRET,
redirectUrl: QB_REDIRECT_URL,
scope: [
Quickbooks.scopes.Accounting,
],
accessToken: '123',
refreshToken: '123',
};
The Functions method
The functions method supplies the appConfig with two functions. getToken
and saveToken
. These functions will be used to get and save the token information. The getToken
and saveToken
functions both return a promise with token information. extra
has the information supplied in the original qbo instance.
// QB config
const QBAppconfig = {
appKey: QB_APP_KEY,
appSecret: QB_APP_SECRET,
redirectUrl: QB_REDIRECT_URL,
scope: [
Quickbooks.scopes.Accounting,
],
getToken(realmId: number | string, appConfig: AppConfig, extra: any) {
// should pull from database or some other storage method
return Promise.resolve(realms[realmId]);
},
saveToken(realmId: number | string, tokenData: StoreTokenData, appConfig: AppConfig, extra: any) {
// should save to database or some other storage method
realms[realmId] = saveTokenData;
return Promise.resolve(saveTokenData);
},
};
The Class method
This method was previously the only store method. It was a class given to AppConfig with a getQBToken and storeQBToken. It returns a promise with the token information. extra
has the information supplied in the original qbo instance.
class QBStore implements QBStoreStrategy {
/**
* Uses a realmID to lookup the token information.
* Must return a promise with the token information
*/
getQBToken(getTokenData: StoreGetTokenData, appConfig: AppConfig, extra: any) {
const realmID = getTokenData.realmID.toString();
// should pull from database or some other storage method
Promise.resolve(realmInfo[realmID]);
}
/**
* Used to store the new token information
* Will be looked up using the realmID
*/
storeQBToken(storeData: StoreSaveTokenData, appConfig: AppConfig, extra: any) {
const realmID = storeData.realmID.toString();
// should save to database or some other storage method
realmInfo[realmID] = storeData
Promis.resolve(realmInfo[realmID])
}
}
// QB config
const QBAppconfig = {
appKey: QB_APP_KEY,
appSecret: QB_APP_SECRET,
redirectUrl: QB_REDIRECT_URL,
scope: [
Quickbooks.scopes.Accounting,
],
storeStrategy: new QBStore(),
};
OAuth
The OAuth process is used to get the initial token information. The OAuth process is a 3 step process. The first step is to generate an OAuth link. The second step is to use the authCode to create the token. The third step is to use the token to make requests to Quickbooks. The first step is done by using the authorizeUrl method. The second step is done by using the createToken method. The third step is done by using the Quickbooks class.
The authorizeUrl method will return a url to redirect the user to. The user will then login to Quickbooks and authorize your app. Once the user authorizes your app, they will be redirected to the redirectUrl you supplied in the config. The redirectUrl will have a query string with the authCode and realmID. The authCode is used to create the token and the realmID is used to make requests to Quickbooks.
// --- End points required to get inital token, Express example
// QB requestToken - Used to start the process
const states = {}; // optional, can be anything you want to track states
app.get("/requestToken", (req, res) => {
const state = Quickbooks.generateState(); // optional
states[state] = true; // optional
const authUrl = Quickbooks.authorizeUrl(QBAppconfig, state); // state is optional
res.redirect(authUrl);
});
// QB token callback - This endpoint must match what you put in your quickbooks app and config
app.get("/callback", async (req, res) => {
let realmID = req.query.realmId;
let authCode = req.query.code;
let state = req.query.state;
// should check state here to prevent CSRF attacks
if (!states[state]) {
res.sendStatus(401);
return;
}
states[state] = false;
// check if realmID and authCode are present
if (!realmID || typeof realmID !== "string" || !authCode || typeof authCode !== "string") {
res.sendStatus(404)
return;
}
// create token
try {
var qbo = new Quickbooks(QBAppconfig, realmID);
const newToken = await qbo.createToken(authCode);
res.send(newToken); // Should not send token out
} catch (err) {
console.log("Error getting token", err);
res.send(err).status(500);
}
});
Query
The query is used to search for a resources. The query is a javascript object or an array of query items that will be converted to a query string. You can also create your own query string instead. Quickbooks does not allow OR in the where statement so all filters will be joined by AND.
There are two main methods for querying. find[EntityName] and count[EntityName]. The find method will return the resources and the count method will return the count of the resources.
Special query properties
| Property | Type | Description | | --- | --- | --- | | limit | number | The limit is the number of resources to return. The default and max is 1000. special default of 1000 if fetchAll is true | | offset | number | The offset is the number of resources to skip. The default is 0. converts to startposition in the query string by adding 1 | | asc | string | The asc is the field name to sort by in ascending order. The default is undefined. Cannot be used with desc or sort | | desc | string | The desc is the field name to sort by in descending order. The default is undefined. Cannot be used with asc or sort | | sort | string, string[], string[][] | The sort is an array of field names to sort by. The default is undefined. Cannot be used with asc or desc. More information on sorting below | | fetchAll | boolean | The fetchAll is a boolean to fetch all the resources. The default is false. If true, will make multiple requests to get all the resources. Limit and offset will be used so setting a smaller limit will make more requests to fetch all the resources. If limit is not set, a default limit of 1000 will be used. | | items | QueryItem[] | The items is an array of query items. The default is undefined. The items array is an array of query items. The query item is an object with the following properties: | | items.field | string | The field is the field name to filter by. Required | | items.value | string | The value is the value to filter by. Required | | items.operator | "=", "IN", "<", ">", "<=", ">=", "LIKE" | The operator is the operator to use for the filter. The default is "=". Available values are | | [key] | string | Any other property will be converted to a query string. The key will be the field name and the value will be the value to filter by. The operator will be "=" |
Find
The find method is used to find resources.
const customers = await qbo.findCustomers({
Id: "1234",
limit: 10,
});
const customers = await qbo.findCustomers({
field: "Id",
value: "1234",
operator: "=", // optional, default is "="
});
const customers = await qbo.findCustomers({
limit: 10,
items: [
{
field: "Id",
value: "1234"
},
],
});
const customers = await qbo.findCustomers("SELECT * FROM Customer WHERE Id = '1234'");
// return object looks like:
// {
// QueryResponse: {
// startPosition?: number;
// totalCount?: number;
// maxResults?: number;
// Customer?: Customer[];
// };
// time: string;
// }
Count
The count method is used to count the number of resources. The count method will return a queryrequest with a single property called totalCount. The totalCount is the number of resources that match the query. You can use the same input for count[EntittyName] as you do for find[EntityName].
const count = await qbo.countCustomers({
Id: "1234",
});
const count = await qbo.countCustomers({
field: "Name",
value: "hello%world",
operator: "like",
});
// return object looks like:
// {
// QueryResponse: {
// totalCount: number;
// };
// time: string;
// }
Sorting query
You can sort the query by using the sort property or for single sorting the asc or desc fields. You can only use 1 of the 3 methods on a query. The sort property is an array of either string or array. if the item is an array, the first item in the array is the field name and the second item is the direction. The direction can be ASC or DESC. If the item is a string, it will be the field name and sorted ASC. If the sort field is an array of 2 strings, the first item is the field name and the second item is the direction. The direction can be ASC or DESC. capitlization of ASC or DESC does not matter
const customers = await qbo.findCustomers({
asc: "Id",
limit: 10,
});
const customers = await qbo.findCustomers({
desc: "Id",
limit: 10,
});
const customers = await qbo.findCustomers({
sort: [["Id", "desc"], ["Name", "asc"]],
limit: 10,
});
const customers = await qbo.findCustomers({
sort: [["Id", "desc"], "Name"],
limit: 10,
});
const customers = await qbo.findCustomers({
sort: ["Id", "Name"],
limit: 10,
});
const customers = await qbo.findCustomers({
sort: ["Id", "desc"],
limit: 10,
});
Webhook
The webhook is used to verify the webhook signature. The webhook signature is a sha256 hash of the payload and compared with the verify webhook string you receive once you create the webhook in Quickbooks. To see how to configure the webhook url, go here: Quickbooks Webhook Docs. There is a helper method for checking the signature against the payload to confirm the webhook is verfied. There is also types to use for the payload. The webhook will be sent to periodically (seems pretty quick) with all changes on any realms your app is connected to.
app.post("/qbwebhook", (req, res) => {
const webhookPayload = req.body as WebhookPayload
const signature = req.get('intuit-signature');
console.log("signature", signature, "webhookPayload", JSON.stringify(webhookPayload, null, 2))
if (!signature) {
console.log("no signature");
res.status(401).send('FORBIDDEN');
return;
}
const signatureCheck = Quickbooks.VerifyWebhookWithConfig(QBAppconfig, webhookPayload, signature);
// const signatureCheck = Quickbooks.VerifyWebhook(verifyString, webhookPayload, signature);
// const signatureCheck = qbo.VerifyWebhook(webhookPayload, signature); // instance
if (!signatureCheck) {
console.log("signatureCheck failed");
res.status(401).send('FORBIDDEN');
return
}
console.log("webhookPayload is verified", webhookPayload);
res.status(200).send('SUCCESS');
// Do stuff here with the webhookPayload
/*
{
"eventNotifications": [{
"realmId": "193514507456064",
"dataChangeEvent": {
"entities": [
{
"name": "Customer",
"id": "67",
"operation": "Create",
"lastUpdated": "2023-10-27T19:26:27.000Z"
}
]
}
}]
}
*/
})
Change Data Capture (CDC)
The change data capture (cdc) operation returns a list of objects that have changed since a specified time. This operation is for an app that periodically polls data services in order to refresh its local copy of object data. The app calls the cdc operation, specifying a comma separated list of object types and a date-time stamp specifying how far to look back. Data services returns all objects specified by entityList that have changed since the specified date-time. Look-back time can be up to 30 days.
The since date can be a Date, number or string. If it is a number, it will be converted to a date then ISO 8601 string. If it is a string, it will be sent as is. Can be YYYY-MM-DD or full ISO 8601. If it is a date, it will be converted to ISO 8601
// minus 30 days from today
const testDateDate = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
const cdcData = await qbo.changeDataCapture(['Invoice', 'Customer'], testDateDate);
console.log("cdcData", cdcData);
QuickBooks Methods
Kind: global class
- QuickBooks
- new QuickBooks(appConfig, realmID)
- instance
- .authorizeUrl() ⇒ string
- .createToken(authCode, realmID) ⇒ object
- .saveToken(token)
- .getToken()
- .refreshWithAccessToken(token) ⇒ Token
- .refreshAccessToken() ⇒ Token
- .revokeAccess(useRefresh)
- .validateIdToken()
- .getPublicKey(modulus, exponent)
- .getUserInfo()
- .batch(items)
- .changeDataCapture(entities, since)
- .upload(filename, contentType, stream, entityType, entityId)
- .createAccount(account)
- .createAttachable(attachable)
- .createBill(bill)
- .createBillPayment(billPayment)
- .createClass(class)
- .createCreditMemo(creditMemo)
- .createCustomer(customer)
- .createDepartment(department)
- .createDeposit(deposit)
- .createEmployee(employee)
- .createEstimate(estimate)
- .createInvoice(invoice)
- .createItem(item)
- .createJournalCode(journalCode)
- .createJournalEntry(journalEntry)
- .createPayment(payment)
- .createPaymentMethod(paymentMethod)
- .createPurchase(purchase)
- .createPurchaseOrder(purchaseOrder)
- .createRefundReceipt(refundReceipt)
- .createSalesReceipt(salesReceipt)
- .createTaxAgency(taxAgency)
- .createTaxService(taxService)
- .createTerm(term)
- .createTimeActivity(timeActivity)
- .createTransfer(transfer)
- .createVendor(vendor)
- .createVendorCredit(vendorCredit)
- .getAccount(Id)
- .getAttachable(Id)
- .getBill(Id)
- .getBillPayment(Id)
- .getClass(Id)
- .getCompanyInfo(Id)
- .getCreditMemo(Id)
- .getCustomer(Id)
- .getDepartment(Id)
- .getDeposit(Id)
- .getEmployee(Id)
- .getEstimate(Id)
- .getExchangeRate(options)
- .getEstimatePdf(Id)
- .sendEstimatePdf(Id, sendTo)
- .getInvoice(Id)
- .getInvoicePdf(Id)
- .sendInvoicePdf(Id, sendTo)
- .getItem(Id)
- .getJournalCode(Id)
- .getJournalEntry(Id)
- .getPayment(Id)
- .getPaymentMethod(Id)
- .getPreferences()
- .getPurchase(Id)
- .getPurchaseOrder(Id)
- .getRefundReceipt(Id)
- .getReports(Id)
- .getSalesReceipt(Id)
- .getSalesReceiptPdf(Id)
- .sendSalesReceiptPdf(Id, sendTo)
- .getTaxAgency(Id)
- .getTaxCode(Id)
- .getTaxRate(Id)
- .getTerm(Id)
- .getTimeActivity(Id)
- .getTransfer(Id)
- .getVendor(Id)
- .getVendorCredit(Id)
- .updateAccount(account)
- .updateAttachable(attachable)
- .updateBill(bill)
- .updateBillPayment(billPayment)
- .updateClass(class)
- .updateCompanyInfo(companyInfo)
- .updateCreditMemo(creditMemo)
- .updateCustomer(customer)
- .updateDepartment(department)
- .updateDeposit(deposit)
- .updateEmployee(employee)
- .updateEstimate(estimate)
- .updateInvoice(invoice)
- .updateItem(item)
- .updateJournalCode(journalCode)
- .updateJournalEntry(journalEntry)
- .updatePayment(payment)
- .updatePaymentMethod(paymentMethod)
- .updatePreferences(preferences)
- .updatePurchase(purchase)
- .updatePurchaseOrder(purchaseOrder)
- .updateRefundReceipt(refundReceipt)
- .updateSalesReceipt(salesReceipt)
- .updateTaxAgency(taxAgency)
- .updateTaxCode(taxCode)
- .updateTaxRate(taxRate)
- .updateTerm(term)
- .updateTimeActivity(timeActivity)
- .updateTransfer(Transfer)
- .updateVendor(vendor)
- .updateVendorCredit(vendorCredit)
- .updateExchangeRate(exchangeRate)
- .deleteAttachable(idOrEntity)
- .deleteBill(idOrEntity)
- .deleteBillPayment(idOrEntity)
- .deleteCreditMemo(idOrEntity)
- .deleteDeposit(idOrEntity)
- .deleteEstimate(idOrEntity)
- .deleteInvoice(idOrEntity)
- .deleteJournalCode(idOrEntity)
- .deleteJournalEntry(idOrEntity)
- .deletePayment(idOrEntity)
- .deletePurchase(idOrEntity)
- .deletePurchaseOrder(idOrEntity)
- .deleteRefundReceipt(idOrEntity)
- .deleteSalesReceipt(idOrEntity)
- .deleteTimeActivity(idOrEntity)
- .deleteTransfer(idOrEntity)
- .deleteVendorCredit(idOrEntity)
- .voidInvoice(idOrEntity)
- .voidPayment(payment)
- .findAccounts(criteria)
- .findAttachables(criteria)
- .findBills(criteria)
- .findBillPayments(criteria)
- .findBudgets(criteria)
- .findClasses(criteria)
- .findCompanyInfos(criteria)
- .findCreditMemos(criteria)
- .findCustomers(criteria)
- .findDepartments(criteria)
- .findDeposits(criteria)
- .findEmployees(criteria)
- .findEstimates(criteria)
- .findInvoices(criteria)
- .findItems(criteria)
- .findJournalCodes(criteria)
- .findJournalEntries(criteria)
- .findPayments(criteria)
- .findPaymentMethods(criteria)
- .findPreferenceses(criteria)
- .findPurchases(criteria)
- .findPurchaseOrders(criteria)
- .findRefundReceipts(criteria)
- .findSalesReceipts(criteria)
- .findTaxAgencies(criteria)
- .findTaxCodes(criteria)
- .findTaxRates(criteria)
- .findTerms(criteria)
- .findTimeActivities(criteria)
- .findTransfers(criteria)
- .findVendors(criteria)
- .findVendorCredits(criteria)
- .findExchangeRates(criteria)
- .reportBalanceSheet(options)
- .reportProfitAndLoss(options)
- .reportProfitAndLossDetail(options)
- .reportTrialBalance(options)
- .reportCashFlow(options)
- .reportInventoryValuationSummary(options)
- .reportCustomerSales(options)
- .reportItemSales(options)
- .reportCustomerIncome(options)
- .reportCustomerBalance(options)
- .reportCustomerBalanceDetail(options)
- .reportAgedReceivables(options)
- .reportAgedReceivableDetail(options)
- .reportVendorBalance(options)
- .reportVendorBalanceDetail(options)
- .reportAgedPayables(options)
- .reportAgedPayableDetail(options)
- .reportVendorExpenses(options)
- .reportTransactionList(options)
- .reportGeneralLedgerDetail(options)
- .reportTaxSummary(options)
- .reportDepartmentSales(options)
- .reportClassSales(options)
- .reportAccountListDetail(options)
- static
- .authorizeUrl(appConfig) ⇒ string
- .createToken(appConfig, authCode, realmID) ⇒ object
- ._dateNotExpired(expired_timestamp) ⇒ boolean
- .isAccessTokenValid(token) ⇒ boolean
- .isRefreshTokenValid(token) ⇒ boolean
- .saveToken(store, info)
- .getToken()
new QuickBooks(appConfig, realmID)
Node.js client encapsulating access to the QuickBooks V3 Rest API. An instance of this class should be instantiated on behalf of each user and company accessing the api.
| Param | Description | | --- | --- | | appConfig | application information | | realmID | QuickBooks companyId, returned as a request parameter when the user is redirected to the provided callback URL following authentication |
quickBooks.authorizeUrl() ⇒ string
Redirect link to Authorization Page
Kind: instance method of QuickBooks Returns: string - authorize Uri
quickBooks.createToken(authCode, realmID) ⇒ object
Creates new token for the realmID from the returned authorization code received in the callback request
Kind: instance method of QuickBooks Returns: object - new token with expiration dates from storeStrategy
| Param | Type | Description | | --- | --- | --- | | authCode | string | The code returned in your callback as a param called "code" | | realmID | number | The company identifier in your callback as a param called "realmId" |
quickBooks.saveToken(token)
Save token
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | token | object | the token to send to store area |
quickBooks.getToken()
Get token
Kind: instance method of QuickBooks
quickBooks.refreshWithAccessToken(token) ⇒ Token
Use the refresh token to obtain a new access token.
Kind: instance method of QuickBooks Returns: Token - returns fresh token with access_token and refresh_token
| Param | Type | Description | | --- | --- | --- | | token | Token | has the refresh_token |
quickBooks.refreshAccessToken() ⇒ Token
Use the refresh token to obtain a new access token.
Kind: instance method of QuickBooks Returns: Token - returns fresh token with access_token and refresh_token
quickBooks.revokeAccess(useRefresh)
Use either refresh token or access token to revoke access (OAuth2).
Kind: instance method of QuickBooks
| Param | Description | | --- | --- | | useRefresh | boolean - Indicates which token to use: true to use the refresh token, false to use the access token. |
quickBooks.validateIdToken()
Validate id_token
Kind: instance method of QuickBooks
quickBooks.getPublicKey(modulus, exponent)
get Public Key
Kind: instance method of QuickBooks
| Param | | --- | | modulus | | exponent |
quickBooks.getUserInfo()
Get user info (OAuth2).
Kind: instance method of QuickBooks
quickBooks.batch(items)
Batch operation to enable an application to perform multiple operations in a single request. The following batch items are supported: create update delete query The maximum number of batch items in a single request is 25.
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | items | object | JavaScript array of batch items |
quickBooks.changeDataCapture(entities, since)
The change data capture (CDC) operation returns a list of entities that have changed since a specified time.
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | entities | object | Comma separated list or JavaScript array of entities to search for changes | | since | object | number | string | JS Date object, JS Date milliseconds, or string in ISO 8601 - to look back for changes until |
quickBooks.upload(filename, contentType, stream, entityType, entityId)
Uploads a file as an Attachable in QBO, optionally linking it to the specified QBO Entity.
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | filename | string | the name of the file | | contentType | string | the mime type of the file | | stream | object | ReadableStream of file contents | | entityType | object | optional string name of the QBO entity the Attachable will be linked to (e.g. Invoice) | | entityId | object | optional Id of the QBO entity the Attachable will be linked to |
quickBooks.createAccount(account)
Creates the Account in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | account | object | The unsaved account, to be persisted in QuickBooks |
quickBooks.createAttachable(attachable)
Creates the Attachable in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | attachable | object | The unsaved attachable, to be persisted in QuickBooks |
quickBooks.createBill(bill)
Creates the Bill in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | bill | object | The unsaved bill, to be persisted in QuickBooks |
quickBooks.createBillPayment(billPayment)
Creates the BillPayment in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | billPayment | object | The unsaved billPayment, to be persisted in QuickBooks |
quickBooks.createClass(class)
Creates the Class in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | class | object | The unsaved class, to be persisted in QuickBooks |
quickBooks.createCreditMemo(creditMemo)
Creates the CreditMemo in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | creditMemo | object | The unsaved creditMemo, to be persisted in QuickBooks |
quickBooks.createCustomer(customer)
Creates the Customer in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | customer | object | The unsaved customer, to be persisted in QuickBooks |
quickBooks.createDepartment(department)
Creates the Department in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | department | object | The unsaved department, to be persisted in QuickBooks |
quickBooks.createDeposit(deposit)
Creates the Deposit in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | deposit | object | The unsaved Deposit, to be persisted in QuickBooks |
quickBooks.createEmployee(employee)
Creates the Employee in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | employee | object | The unsaved employee, to be persisted in QuickBooks |
quickBooks.createEstimate(estimate)
Creates the Estimate in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | estimate | object | The unsaved estimate, to be persisted in QuickBooks |
quickBooks.createInvoice(invoice)
Creates the Invoice in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | invoice | object | The unsaved invoice, to be persisted in QuickBooks |
quickBooks.createItem(item)
Creates the Item in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | item | object | The unsaved item, to be persisted in QuickBooks |
quickBooks.createJournalCode(journalCode)
Creates the JournalCode in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | journalCode | object | The unsaved journalCode, to be persisted in QuickBooks |
quickBooks.createJournalEntry(journalEntry)
Creates the JournalEntry in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | journalEntry | object | The unsaved journalEntry, to be persisted in QuickBooks |
quickBooks.createPayment(payment)
Creates the Payment in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | payment | object | The unsaved payment, to be persisted in QuickBooks |
quickBooks.createPaymentMethod(paymentMethod)
Creates the PaymentMethod in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | paymentMethod | object | The unsaved paymentMethod, to be persisted in QuickBooks |
quickBooks.createPurchase(purchase)
Creates the Purchase in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | purchase | object | The unsaved purchase, to be persisted in QuickBooks |
quickBooks.createPurchaseOrder(purchaseOrder)
Creates the PurchaseOrder in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | purchaseOrder | object | The unsaved purchaseOrder, to be persisted in QuickBooks |
quickBooks.createRefundReceipt(refundReceipt)
Creates the RefundReceipt in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | refundReceipt | object | The unsaved refundReceipt, to be persisted in QuickBooks |
quickBooks.createSalesReceipt(salesReceipt)
Creates the SalesReceipt in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | salesReceipt | object | The unsaved salesReceipt, to be persisted in QuickBooks |
quickBooks.createTaxAgency(taxAgency)
Creates the TaxAgency in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | taxAgency | object | The unsaved taxAgency, to be persisted in QuickBooks |
quickBooks.createTaxService(taxService)
Creates the TaxService in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | taxService | object | The unsaved taxService, to be persisted in QuickBooks |
quickBooks.createTerm(term)
Creates the Term in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | term | object | The unsaved term, to be persisted in QuickBooks |
quickBooks.createTimeActivity(timeActivity)
Creates the TimeActivity in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | timeActivity | object | The unsaved timeActivity, to be persisted in QuickBooks |
quickBooks.createTransfer(transfer)
Creates the Transfer in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | transfer | object | The unsaved Transfer, to be persisted in QuickBooks |
quickBooks.createVendor(vendor)
Creates the Vendor in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | vendor | object | The unsaved vendor, to be persisted in QuickBooks |
quickBooks.createVendorCredit(vendorCredit)
Creates the VendorCredit in QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | vendorCredit | object | The unsaved vendorCredit, to be persisted in QuickBooks |
quickBooks.getAccount(Id)
Retrieves the Account from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Account |
quickBooks.getAttachable(Id)
Retrieves the Attachable from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Attachable |
quickBooks.getBill(Id)
Retrieves the Bill from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Bill |
quickBooks.getBillPayment(Id)
Retrieves the BillPayment from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent BillPayment |
quickBooks.getClass(Id)
Retrieves the Class from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Class |
quickBooks.getCompanyInfo(Id)
Retrieves the CompanyInfo from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent CompanyInfo |
quickBooks.getCreditMemo(Id)
Retrieves the CreditMemo from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent CreditMemo |
quickBooks.getCustomer(Id)
Retrieves the Customer from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Customer |
quickBooks.getDepartment(Id)
Retrieves the Department from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Department |
quickBooks.getDeposit(Id)
Retrieves the Deposit from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Deposit |
quickBooks.getEmployee(Id)
Retrieves the Employee from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Employee |
quickBooks.getEstimate(Id)
Retrieves the Estimate from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Estimate |
quickBooks.getExchangeRate(options)
Retrieves an ExchangeRate from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description |
| --- | --- | --- |
| options | object | An object with options including the required sourcecurrencycode
parameter and optional asofdate
parameter. |
quickBooks.getEstimatePdf(Id)
Retrieves the Estimate PDF from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Estimate |
quickBooks.sendEstimatePdf(Id, sendTo)
Emails the Estimate PDF from QuickBooks to the address supplied in Estimate.BillEmail.EmailAddress or the specified 'sendTo' address
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Estimate | | sendTo | string | optional email address to send the PDF to. If not provided, address supplied in Estimate.BillEmail.EmailAddress will be used |
quickBooks.getInvoice(Id)
Retrieves the Invoice from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Invoice |
quickBooks.getInvoicePdf(Id)
Retrieves the Invoice PDF from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Invoice |
quickBooks.sendInvoicePdf(Id, sendTo)
Emails the Invoice PDF from QuickBooks to the address supplied in Invoice.BillEmail.EmailAddress or the specified 'sendTo' address
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Invoice | | sendTo | string | optional email address to send the PDF to. If not provided, address supplied in Invoice.BillEmail.EmailAddress will be used |
quickBooks.getItem(Id)
Retrieves the Item from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Item |
quickBooks.getJournalCode(Id)
Retrieves the JournalCode from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent JournalCode |
quickBooks.getJournalEntry(Id)
Retrieves the JournalEntry from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent JournalEntry |
quickBooks.getPayment(Id)
Retrieves the Payment from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Payment |
quickBooks.getPaymentMethod(Id)
Retrieves the PaymentMethod from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent PaymentMethod |
quickBooks.getPreferences()
Retrieves the Preferences from QuickBooks
Kind: instance method of QuickBooks
quickBooks.getPurchase(Id)
Retrieves the Purchase from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Purchase |
quickBooks.getPurchaseOrder(Id)
Retrieves the PurchaseOrder from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent PurchaseOrder |
quickBooks.getRefundReceipt(Id)
Retrieves the RefundReceipt from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent RefundReceipt |
quickBooks.getReports(Id)
Retrieves the Reports from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Reports |
quickBooks.getSalesReceipt(Id)
Retrieves the SalesReceipt from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent SalesReceipt |
quickBooks.getSalesReceiptPdf(Id)
Retrieves the SalesReceipt PDF from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent SalesReceipt |
quickBooks.sendSalesReceiptPdf(Id, sendTo)
Emails the SalesReceipt PDF from QuickBooks to the address supplied in SalesReceipt.BillEmail.EmailAddress or the specified 'sendTo' address
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent SalesReceipt | | sendTo | string | optional email address to send the PDF to. If not provided, address supplied in SalesReceipt.BillEmail.EmailAddress will be used |
quickBooks.getTaxAgency(Id)
Retrieves the TaxAgency from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent TaxAgency |
quickBooks.getTaxCode(Id)
Retrieves the TaxCode from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent TaxCode |
quickBooks.getTaxRate(Id)
Retrieves the TaxRate from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent TaxRate |
quickBooks.getTerm(Id)
Retrieves the Term from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Term |
quickBooks.getTimeActivity(Id)
Retrieves the TimeActivity from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent TimeActivity |
quickBooks.getTransfer(Id)
Retrieves the Transfer from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Term |
quickBooks.getVendor(Id)
Retrieves the Vendor from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent Vendor |
quickBooks.getVendorCredit(Id)
Retrieves the VendorCredit from QuickBooks
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | Id | string | The Id of persistent VendorCredit |
quickBooks.updateAccount(account)
Updates QuickBooks version of Account
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | account | object | The persistent Account, including Id and SyncToken fields |
quickBooks.updateAttachable(attachable)
Updates QuickBooks version of Attachable
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | attachable | object | The persistent Attachable, including Id and SyncToken fields |
quickBooks.updateBill(bill)
Updates QuickBooks version of Bill
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | bill | object | The persistent Bill, including Id and SyncToken fields |
quickBooks.updateBillPayment(billPayment)
Updates QuickBooks version of BillPayment
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | billPayment | object | The persistent BillPayment, including Id and SyncToken fields |
quickBooks.updateClass(class)
Updates QuickBooks version of Class
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | class | object | The persistent Class, including Id and SyncToken fields |
quickBooks.updateCompanyInfo(companyInfo)
Updates QuickBooks version of CompanyInfo
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | companyInfo | object | The persistent CompanyInfo, including Id and SyncToken fields |
quickBooks.updateCreditMemo(creditMemo)
Updates QuickBooks version of CreditMemo
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | creditMemo | object | The persistent CreditMemo, including Id and SyncToken fields |
quickBooks.updateCustomer(customer)
Updates QuickBooks version of Customer
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | customer | object | The persistent Customer, including Id and SyncToken fields |
quickBooks.updateDepartment(department)
Updates QuickBooks version of Department
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | department | object | The persistent Department, including Id and SyncToken fields |
quickBooks.updateDeposit(deposit)
Updates QuickBooks version of Deposit
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | deposit | object | The persistent Deposit, including Id and SyncToken fields |
quickBooks.updateEmployee(employee)
Updates QuickBooks version of Employee
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | employee | object | The persistent Employee, including Id and SyncToken fields |
quickBooks.updateEstimate(estimate)
Updates QuickBooks version of Estimate
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | estimate | object | The persistent Estimate, including Id and SyncToken fields |
quickBooks.updateInvoice(invoice)
Updates QuickBooks version of Invoice
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | invoice | object | The persistent Invoice, including Id and SyncToken fields |
quickBooks.updateItem(item)
Updates QuickBooks version of Item
Kind: instance method of QuickBooks
| Param | Type | Description | | --- | --- | --- | | item | object | The persistent Item, including Id and SyncToken fields |
quickBooks.updateJournalCode(journalCode)
Updates QuickBooks version of JournalCode
Kind: instance method of QuickBooks
| Param | Type | Description |