1. Creating the draft invoice
There are several required fields when creating a draft invoice:
Each line item can include the following fields:
Optional data parameters, for more advanced invoicing functionality, are listed below:
To add the draft invoice, simply POST the invoice’s JSON object to the /invoice endpoint:
2. Generating an invoice preview
The response from POST /invoice contains the invoice’s id, which you should store in your database.htmlReport attribute, which contains an embeddable HTML body of the user’s invoice, including their custom branding that you set up earlier:
htmlReport field and embed that in your product’s UI for your user to review.
3. Sending a quote to your user’s client
You can also email a quote to the client. Once you have obtained aninvoiceId, you can simply POST that to the /sendInvoice endpoint as follows, and it will send the quote to the emails associated with that invoice’s client record. The email will contain a PDF attachment, with “DRAFT” watermarked across it. If you’d like these emails to originate from your own domain, simply email api@tight.com and our API team will work with you to set that up.
4. Updating a draft
You can make updates to a draft invoice by simply repeating the initial POST to the /invoice, and including the invoice’sid: