InvoicesAPI

new InvoicesAPI(rest)

This class is used to interact with Invoices in TidyHQ.
Parameters:
NameTypeDescription
restRestThe rest instance to use for requests.

Methods

(async) addPayment(invoiceID, optionsopt) → {Promise.<TidyAPI_V1_Payment>}

This function is used to add a payment to an invoice.
Parameters:
NameTypeAttributesDescription
invoiceIDstringThe ID of the invoice.
optionsobject<optional>
The options to create the payment with. At least one option is required that isn't the access_token.
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
amountnumber<optional>
The amount of the payment expressed as a decimal.
payment_typeTidy_V1_PaymentType<optional>
The type of payment.
datestring<optional>
The date of the payment in ISO 8601 format.
Returns:
- The newly created payment.
Type: 
Promise.<TidyAPI_V1_Payment>

(async) createInvoice(invoice, optionsopt) → {Promise.<TidyAPI_V1_Invoice>}

Create a new invoice.
Parameters:
NameTypeAttributesDefaultDescription
invoiceTidy_V1_InvoiceParamsThe invoice to create.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The newly created invoice.
Type: 
Promise.<TidyAPI_V1_Invoice>

(async) deleteInvoice(invoiceID, optionsopt) → {Promise.<TidyAPI_Response>}

Delete an invoice.
Parameters:
NameTypeAttributesDefaultDescription
invoiceIDstringThe ID of the invoice.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- Success or failure.
Type: 
Promise.<TidyAPI_Response>

(async) getInvoice(invoiceID, optionsopt) → {Promise.<TidyAPI_V1_Invoice>}

Get a single invoice from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
invoiceIDstringThe ID of the invoice to get
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An invoice.
Type: 
Promise.<TidyAPI_V1_Invoice>

(async) getInvoices(optionsopt) → {Promise.<TidyAPI_V1_Invoices>}

Get a list of invoices from TidyHQ.
Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
limitnumber<optional>
The maximum number of invoices to return.
offsetnumber<optional>
The number of invoices to skip.
status"activated" | "cancelled" | "all"<optional>
The status of the invoice.
updated_sincestring<optional>
The timestamp of the last update in ISO 8601 format.
Returns:
- An array of invoices.
Type: 
Promise.<TidyAPI_V1_Invoices>