Invoice a sales order
distru-create-invoiceWritePOSQuickBooksCreates the invoice of a sales order that has none. Reaches QuickBooks unless its total is negative, and your POS (Dutchie, Blaze or Treez) when the customer is mapped to one of its retailers.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| salesOrderId | string | Yes | Sales order to invoice. Resolve via distru-search-sales-orders. |
Output
Presence on a nested field assumes its parent exists.
| Field | Type | Presence |
|---|---|---|
| invoice | object | Always |
| invoice. | string | Always |
| invoice. | object[] | Always |
| invoice. | object | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | enumCHECKBOXDATEDROPDOWNTEXT | Always |
| invoice. | string | Can be null |
| invoice. | string | Always |
| invoice. | enumNOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Can be null |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Can be null |
| invoice. | string | Can be null |
| invoice. | string | Can be null |
| invoice. | enumDELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED | Can be null |
| invoice. | string | Can be null |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object | Null or absent |
| invoice. | string | Always |
| invoice. | string | Null or absent |
| invoice. | object | Can be null |
| invoice. | string | Always |
| invoice. | object | Always |
| invoice. | string | Always |
| invoice. | object | Can be null |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object | Can be null |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object[] | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | boolean | Always |
| invoice. | string | Can be null |
| invoice. | object | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object | Can be null |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object | Can be null |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | object[] | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Always |
| invoice. | string | Can be null |
| invoice. | string | Always |
| invoice. | boolean | Always |
What the AI reads
Creates the invoice of a sales order that has none, the same invoice Distru creates when an order is saved with invoicing on. Bills every line at its ordered minus returned quantity, in the order's line order, with the order's charges; fully returned lines are left out. Dates, due date, payment term, owner, billing location and notes come from the order; the invoice number is assigned per company. Rejected when the order already has an invoice, voided ones included, even one the caller's team can't see (so an empty distru-get-sales-order includeInvoices doesn't prove there is none); when the order is canceled or merged, has no customer or billing location, its billing location was deleted or isn't the customer's, it lacks the due date or the date the invoice date is taken from, or it has nothing left to bill; when the company's invoice numbering (company settings) gives no number, a taken one or one with special characters; when the order's owner can't own invoices in the caller's team; and when the company's custom invoice rules refuse it. Required invoice custom fields are left empty, since this tool can't set them. Queues a QuickBooks and a POS sync when connected; sends no invoice email. To rebuild an invoice, delete it with distru-delete-invoice and create it again; partial invoices and edits are UI-only. Returns the invoice in distru-get-invoice's shape, with its items and charges. Requires authentication via Authorization header.