Export Customer invoices


  • The customer invoice is created in Next and is approved before it is transferred to accounting system.
  • Accounting system is master for invoice number


  • There is no support for generating electronic invoice files in Next API, hence it will be required that the integrator generates files according to data in Next if an electronic invoice file should be distributed from an external service/application.

How it works

When it comes to customer invoices it is important to make sure that the integration supports scenarios such as:

  • Invoice with and without VAT
  • Invoice with tax reduction (Sweden)
  • Invoice with reversed contractor VAT (if applicable)
  • Credit invoice (part credit and full credit)
  • Invoices with or without OCR
  • Invoice update – external invoice number, payed date etc
  • Invoices that are unlocked and locked again
  • Invoices that are locked, but where the integration job has failed

Process for creating and synchronizing customer invoices

Customer invoices are usually handled according to following steps

  1. A preliminary customer invoice is created and given a preliminary number shown in the field invoicenumber
  2. The invoice is reviewed by a project leader or corresponding role and marked readyforinvoice if ok
  3. The invoice is reviewed by an administrator and marked as locked to indicate that invoice is ready to be transferred to the accounting system
  4. Invoiceno will be set by Next, but note that this is an internal number in Next.
  5. The invoice is exported to the accounting system to update the accounts receivable and the ledger
  6. Definite invoice number is set by accounting system.
  7. The definite invoice number from the accounting system is posted to the field Extinvoiceno in Next
  8. The invoice is distributed to the customer. Distribution is generally handled from Next by using our customer invoice distribution service (Next c-invoice) which also support electronic invoices.

Comments to above

  • It is recommended to let the accounting system generate the definite invoice number and post it to Next since this will reduce the risk of mismatches and also make it possible for users to create manual invoices in the accounting system without the need of having multiple series.
  • The field extinvoiceno can be used as a feedback field to indicate that there are pending jobs or if errors have occurred. For example
    • When the get action is started “Pending” is posted to the field
    • If an error occur the error message with a prefix is posted to the field, for ex “!ErrorXXX”
  • An invoice can be locked, unlocked and locked again. It is therefore crucial that the integration only handles a post once to update the accounts receivable and the ledger. Scenarios that might lead to an invoice being unlocked could be:
    • An error has occurred where changes need to be made to make it possible to trigger a new export with correct data.
    • The customer address or reference is wrong and needs to be updated before distributing the invoice to the customer.
    • An attachment is missing and needs to be added before distributing the invoice to the customer.
  • Invoices should only be exported if they are
    • locked and extinvoiceno is empty
    • locked, extinvoiceno has an error message but the post has been changed since last run.
  • The invoice picture can be fetched using the endpoint /customerinvoice/{customerinovice_id}/pdf/