Use case
As an integrator, I want to import purchase invoices into Procountor. I also want to set the accounts of the other system for the accounting entries.
Note: In Procountor software, the accounts are related into accounting page of invoice. Invoice itself does not have accounts, so you are not able to import accounts by using invoice related endpoints. A successfully saved invoice always includes also accounting page (ledgerReceipt in API). The accounting page has all accounting related data including default accounts based on the defaults set in Procountor. So, the existing accounts should be updated to accounting page of invoice (ledgerReceipt in API). Please follow the instructions below to update the accounts to accounting page of imported invoice. Used accounts must be found in the chart of accounts of Procountor.
Endpoints to be used and other requirements
GET /coa endpoint retrieves a chart of accounts saved in Procountor environment.
POST /invoices endpoint creates a new invoice. Status of new invoice is always “UNFINISHED”. Successfully saved invoice returns invoice data including also ledgerReceiptId of the invoice. The ledgerReceiptId is needed for updating or adding dimensions and/or accounts to accounting page of invoice.
*)POST invoice request should include the extraInfo > accountingByRow > true.
GET /ledgerreceipts{id} endpoint retrieves the accounting page of the saved invoice.
PUT /ledgerreceipts{id} endpoint updates the accounting page of the saved invoice. When updating accounts for the accounting page of the saved invoice, copy first the content of GET request and change wanted accounts for the transactions rows.
Transaction types of transactions rows
Transaction rows have different types that are invisible in UI. Transaction type “REVERSING_ENTRY” is meant for credit entry (default 2880 Maksuliikennetili) of the receipt, and it is created automatically by Procountor. The row(s) of transactions type “ENTRY” are created based on invoice rows*) and are performed as costs as debit entries. The transaction row of transaction type “RECONCILIATION_ENTRY” is also created automatically by Procountor. The entry row is meant for automatically made balancing difference (as default to account '8890 Balancing differences' in general ledger accounting)
Targeting transaction rows to invoice rows
Targeting transaction rows to invoice rows may be challenging as Procountor software does not specify the linking between invoice rows and transaction rows. We can recommend the following workaround solution to facilitate recognition of transaction rows:
Source system could add its own identification to the beginning of invoice row or invoice comment row when posting an invoice. By using this own identification, which will be copied to the description of transaction row, source system can identify rows.
Sample: sample of invoice row with own identification in the beginning of invoice row (see field “product”)
"invoiceRows": [
{
"product": "1A Project work",
"quantity": 1,
"unit": "PIECE",
"unitPrice": 755,
"discountPercent": 0,
"vatPercent": 24
},
Sample: sample of transactions row with own identification in the beginning of transaction row (see field “description”). Content of description field is copied from invoice rows automatically by system.
"transactions": [
{
"transactionId": 99660228,
"transactionType": "ENTRY",
"account": "4000",
"accountingValue": 755,
"vatPercent": 24,
"description": "1A Project work",
"dimensionItemValues": [
{
"dimensionId": 85919,
"itemId": 136341,
"value": 755
}
]
},
An alternative way to set wanted accounts to the transactions rows of the accounting page is to re-write all or some of the transaction rows again.
The ids of saved invoice and its ledger receipt are useful to be stored. By using the ids, you can search, update or invalidate objects later via API if needed. Updating or invalidating might be forbidden because of status of the object.
Other information
The original invoice of the supplier can be also added into invoice as attachment. Using POST /attachment endpoint you can add an attachment. The attachment can be of any type but limited to max 10000000 bytes.
Chart of accounts is available via Procountor API
- GET /coa
Used VAT status codes are available via Procountor API
- GET /vats/default