partner_id. This guide explains how to link each customer and supplier of your software to a partner of the accounting software, and how to keep this link up to date. The same logic applies to clients and to suppliers.
1. Load the partners
When the end-user connects their accounting software, fetch all the partners:- Get clients for your customers.
- Get suppliers for your suppliers.
2. Match your partners
For each customer or supplier of your software, look for its partner in the accounting software. Chift advises the criteria below, in this order. Compare each criterion with all the partners before you try the next one: the most specific criterion wins.- Existing link. You already stored the
idof the partner for this customer or supplier. Reuse it. - Partner code. Compare the code of your customer or supplier (for example, its account number in your software) with
third_party_accountand withexternal_reference. Compare your own reference withexternal_reference. - Company number. Compare it with
company_number. - VAT number. Compare it with
vat. Compare the company number first: the members of a VAT group share one VAT number. - Name. Compare it with
third_party_accountand withexternal_reference. For an individual, compare the full name (first name and last name) with the full name of the partner.
- Compare only the active partners (
activeistrue). - For the company number and the VAT number, remove the dots and the spaces, and ignore the case. For example,
BE 0123.456.789matchesBE0123456789. - For the partner code, remove the spaces and ignore the case. Some accounting software pads the code with trailing zeros: compare the codes without them.
- An empty value never matches.
- Do not match on the
account_numberof the partner. It can be a shared control account, used by many partners.
id with your customer or supplier. Send this id as partner_id on every invoice or entry for this customer or supplier.
3. Create the missing partners
When no partner matches, create it before you book its first invoice:- Create client for a customer.
- Create supplier for a supplier.
name: the name shown in the accounting software. For an individual, setis_companytofalseand sendfirst_nameandlast_name.addresses: the list of addresses. Each address needsaddress_type,street,city,postal_codeandcountry.
vat, company_number and external_reference (your own identifier of the customer or supplier).
Store the id of the created partner, as for a match.
Some accounting software keeps clients and suppliers in one list. When your customer is also a supplier there, send the id of the existing supplier in the force_merge parameter of Create client (or the id of the existing client in Create supplier). The accounting software then merges the two.
Some accounting software cannot create partners through the API. For these connectors, send the partner with
partner_info on the invoice. See Create invoices.4. Keep the partners up to date
Partners change in the accounting software: the accountant creates, edits or deactivates them. Refresh your stored partners at regular intervals:- Pass the date of your last refresh as
updated_after. The API returns only the partners created or updated after this date. See Incremental synchronization. - To look up one partner, use the
searchparameter. It filters onname,email,first_name,last_name,external_reference,vatandcompany_number.
updated_after. Without it, fetch all the partners again and compare them with the partners you stored. Check the coverage matrix.