Credit notes are typically used to denote a client refund or a discount (credit) on future purchases. To refund a business you must create a “Credit invoice”, whereas a “Retail Sales Credit Note” must be created whenever the client is a private individual.
According to the myDATA specifications, Credit invoices are further divided into Associated credit invoices (myDATA document type 5.1) and Non-associated credit invoices (myDATA document type 5.2), depending on whether they cancel a previously issued invoice or not. This guide demonstrates how to create both associated and non-associated credit invoices.
- The guide assumes you’re working on a new Elorus organization, so this step can be omitted.
First lets create a contact so there is someone to bill. In a business context, contacts are individuals or businesses whom you transact with; typically your clients, leads, suppliers and partners. Since Elorus will let you manage your sales as well as your expenses, a contact may represent either a client or a supplier (or even both).
curl -X POST -H "Content-Type: application/json" -H "Authorization: Token ~Your-API-key~" -H "X-Elorus-Organization: ~Your-Organization-ID~" https://api.elorus.com/v1.1/contacts/ -d '{"client_type": "1", "company":"Elorus SA", "vat_number":"9876543210", "addresses":[{"address":"Theofilopoulou 13", "city":"Athens", "zip":"11743", "country": "GR", "ad_type": "bill"}], "is_client": true, "is_supplier":false}
Filter e.g. by “company”, to get the contact ID. Retrieved contact ID in this case is “2482665622824027155”.
curl -X GET -H "Content-Type: application/json" -H "Authorization: Token ~Your-API-key~" -H "X-Elorus-Organization: ~Your-Organization-ID~" https://api.elorus.com/v1.1/contacts/?company="Elorus SA"
In this case, a “Credit Invoice” document type will be needed. There is a “Credit Invoice” document type pre-created. Default title is “Πιστωτικό Τιμολόγιο”.
Search by “title”, to get the document type ID. Retrieved document type ID in this case is “2483498441813001641”. In case the title is changed or the document type is missing, use the Elorus UI to create a new one.
curl -X GET -H "Content-Type: application/json" -H "Authorization: Token ~Your-API-key~" -H "X-Elorus-Organization: ~Your-Organization-ID~" https://api.elorus.com/v1.1/documenttypes/?search="Πιστωτικό Τιμολόγιο"
By default there are some taxes preset in Elorus. Usually 24% tax is used for Greece “Credit Invoice” so the preset tax will be retrieved and used. In case there is a need for a new tax to be created, use of Elorus' UI is mandatory.
Optional steps to create new tax:
Search by “percentage”, to get the tax ID. Retrieved tax ID in this case is “2476911428611605999”. Make sure that “aade_type”:1 is in the response packet.
curl -X GET -H "Content-Type: application/json" -H "Authorization: Token ~Your-API-key~" -H "X-Elorus-Organization: ~Your-Organization-ID~" https://api.elorus.com/v1.1/taxes/?search="24"&search_fields=percentage
The final step, is to create the Credit Invoice itself. The list below describes all the needed fields.
curl -X POST -H "Content-Type: application/json" -H "Authorization: Token ~Your-API-key~" -H "X-Elorus-Organization: ~Your-Organization-ID~" https://api.elorus.com/v1.1/creditnotes/ -d '{"calculator_mode": "total", "currency_code": "EUR", "exchange_rate": "1.000000", "client": "2482665622824027155", "date": "2022-5-20", "draft": true, "documenttype": "2483498441813001641", "mydata_document_type": "5.1", "items": [{"title": "Γάντια Εργασίας", "unit_total": "12.4", "quantity": "1", "taxes": ["2476911428611605999"], "mydata_classification_category": "category1_3", "mydata_classification_type": "E3_561_001"}], "paid_on_receipt": "12.4", "payment_method": "3", "related_documents": ["2483541804331304045"]}'