Hi Alyn,

Unfortunately we do not expose the OCR/FI code on our APIs.

We would love to expose it on REST /invoices at some point though.

For now you can use the following approach to calculate it yourself:

Here's our algorithm for generating the Danish OCR and an example of the calculations

ALGORITHM

Example: Invoice number: 9482575323

First we add an identifier digit:

Invoices get a 0, Reminders get a 3

94825753230

Then we calculate the control digit and attach in the end:

(see example below)

948257532301

Then we add leading zeroes to reach the 15 digits required for an OCR line

000948257532301

EXAMPLE

Example of the calculation of control digit:

9,4,8,2,5,7,5,3,2,3,0

x 2,1,2,1,2,1,2,1,2,1,2 (If result is 10 or greater we do (1 + (X % 10)))

= 9,4,7,2,0,7,0,3,4,3,0

9+4+7+2+0+7+0+3+4+3+0 = 39

Mod 10 of 39 = 9

10 - 9 = 1