API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Get FI-indbetalingskort from invoice

0
I am currently working on an automatic invoice system in PhP which creates invoices on e-conomic and after that gets the faktura number and sets it on a specification file that the company I work at emits to the custommer.

What I did by now works fine, but lately I was asked to get the FI-indbetalingskort from the invoice and write it on the specification file. I took a look on the API and I have honestly no idea if there is something that can help me to get this number.

I heard about the formula used to create this number and for the first part of the number might not be that difficult to calculate, but the main issue is that the clients of the company are split into groups which pay their invoices to different accounts, reason why I am a little bit anxious about getting the right account. Is there any way I can get  this number from e-conomic directly using the APIs?

Also getting the PBS number and the debtor group number would be useful.


Thank you!
created Jan 18, 2017 by alyn509
100% Accept Rate

edited Jan 18, 2017 by alyn509
Q 2 A 0 C 2

2 Answers

+1
 
Best answer
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
answered Jan 18, 2017 by olej
selected Jan 19, 2017 by alyn509
the substraction from 10 at the end we do it if the mod is greater than 7 or any time? And if the invoice number has an even number of digits how do I compute it? ex: invoice number 93948362 I multiply the digits with 21212121 or with 12121212? And are your calculations good? I think you got it wrong from the first 5 on.
+2
PBS data is part of the company information.
It is already exposed in REST on /self:
"pbsNumber": "XXXXXXXX",
"pbsCustomerGroupNumber": "X",
"pbsFiSupplierNumber": "XXXXXXXX",
It will not become available via SOAP.

Debtor Group number lives on the Debtor object in SOAP and on REST customerGroup would for instance be /customers with a filter or /customers/:customerNumber that could give this info.
answered Jan 18, 2017 by olej
I am using SOAP at the moment to book the invoice, and it took really a lot for me to configure a client and actually make it work. If it is better for my problem to use REST can you, please, give me an example of how to connect using REST with the token and how to make a call (CurrentInvoice_Create for instance).
I know these thinks are pretty basic, but I am at my beginning with these technologies and it is hard to understand. I tried before SOAP to work with REST and because I failed I just switched to SOAP seeing it a little easier (and finding some better documentation of how to work with it)
Visma e-conomic A/S
...