This page explains how to use the public API to create advance invoices and invoices with advance payment deductions.
In the Sage Active interface, from a quote an order, it is possible to request the creation of an advance invoice. A form allows defining the advance amount to be invoiced. Then, when generating an invoice for the same customer, it is possible to deduct the amount of one or more advance invoices already issued to the customer.
Technically, Sage Active uses a product ADVANCE_PAYMENT which is not visible in the product list.
Note that this value depends on the legislation, e.g. ACOMPTE for the French Legislation.
An advance invoice will always include a line with this ADVANCE_PAYMENT product and the corresponding advance amount. To deduct an advance payment from an invoice, Sage Active adds a line with a negative quantity associated with the ADVANCE_PAYMENT product, reflecting the amount to be deducted.
In the API context, the same mutation operation createSalesInvoice is used, just like for standard invoice creation.
The only distinction with a classical invoice is:
-
Creating an advance invoice requires using the ADVANCE_PAYMENT product, with a quantity of
1and the amount set to the advance payment value.
Once the advance invoice is created, store its returned ID, as it will be needed later when creating the final invoice. -
Deducting an advance payment from an invoice involves adding one or multiple lines (in case of multiple advance payments) to the invoice with the ADVANCE_PAYMENT product, a quantity of
-1, and the positive amount to be deducted.
For each deduction line (negative quantity), theoriginIdfield must be filled with the ID of the corresponding advance invoice that was previously stored.