If your product or service sales depend on an online store, you are surely familiar with the hassle of maintaining the same data in two places: in the e-shop and in the accounting software. But if you use Flexi, you are well on your way to a solution that can greatly simplify your work and reduce the costs of running your e-shop.
So how do you connect the accounting and sales systems?
Every e-shop operator should first consider how tightly the e-shop needs to be connected to the accounting software. There are essentially two ways to integrate accounting with an e-shop: the synchronization approach and the online approach. Several factors determine which option to choose. One factor is the experience of the developers. Another is whether sales happen only through the e-shop or also through a brick-and-mortar store.
1. Synchronization-based integration of the e-shop and accounting
This approach involves transferring data between the e-shop and the accounting system at set intervals (usually once a day). Typically, new orders or invoices and customer records are transferred from the e-shop into Flexi, while the current price list and stock levels are sent back. This option is generally simpler to implement, and Flexi recommends it if you run your accounting in the cloud. It is less data-intensive, and cloud-hosted Flexi instances are subject to a daily request limit.
2. Online integration of the e-shop and accounting
With this integration approach, each customer request in the e-shop triggers a set of queries to Flexi. For example, when an order is being placed, clicking the order button fetches the current set of payment and shipping methods from Flexi so the customer can choose their preferred options.
This integration method has the advantage that customers always see up-to-date data (stock levels, available products, etc.) and only a small dataset needs to be maintained in the e-shop. An additional benefit is that Flexi's API supports EET (electronic sales registration), so no separate solution is required. The downside is the high data intensity of this integration and the large number of requests sent to Flexi.
Flexi does not recommend this approach if your accounting is hosted in the public cloud. Sooner or later, someone from Flexi would contact you and ask you to reduce traffic due to exceeded limits. Failure to reduce the load may result in your accounting becoming unavailable.
If you choose this integration approach, it is advisable to have the Flexi server installed on the same server as the e-shop. This minimizes response times. The server must also be powerful enough to handle the load.
What data should be transferred from ABRA Flexi to the e-shop?
In both cases, we will need to retrieve from Flexi the list of products (price list, tree structure, attachments), individual pricing for specific customer groups, customer contact records, and stock cards. We need to write orders or invoices and new customers back into Flexi.
Exporting the product list
If you want to retrieve the product list from Flexi into your e-shop, you will be working with the price list register. A query to this register should look like this:
GET /c/{firma}/cenik/(exportNaEshop=true).xml?detail=custom:nazev,kod,skupZboz,sumStavMj,cenaBezna,mj1,cenaZaklBezDph,cenaZaklVcDph,zaruka,mjZarukyK,popis,cenJednotka,eanKod,kratkyPopis,klicSlova,techParam,dodaciLhuta,mjDodaciLhuta&relations=poplatky,prilohy,prislustenstvi,atributy,podobne-zbozi&limit=0
Data from this query will be in XML format, but JSON can also be used. The query returns only items that are flagged for export to the e-shop (the "export to e-shop" checkbox is checked on the price list record). A custom detail level is also used. This level lets you define which columns are included in the output. Another parameter used in the query is the relations parameter, which allows related records to be included in the result (fees, attachments, accessories, similar products, and attributes).
The final parameter, limit=0, tells Flexi that we want all records matching the given criteria (filter). This parameter is very important because by default Flexi only returns the first page of records, which contains 20 items. A value of 0 means: "give me everything." If you use a specific number (e.g. 99999, which is quite common), there will likely come a point over time when the number of records exceeds that limit. https://demo.flexibee.eu/c/demo/cenik/(exportNaEshop=true).xml ?detail=custom:nazev,kod,skupZboz,sumStavMj,cenaBezna,mj1,cenaZaklBezDph, cenaZaklVcDph,zaruka,mjZarukyK,popis,cenJednotka,eanKod,kratkyPopis, klicSlova,techParam,dodaciLhuta,mjDodaciLhuta &relations=poplatky,prilohy,prislustenstvi,atributy,podobne-zbozi&limit=0
Exporting attachments for the product list
The attachments register in Flexi can store various images, manuals, and similar documents. The easiest way to retrieve these attachments for the e-shop is to query the attachments register.
GET /c/{firma}/priloha/(exportNaEshop=true and cenik is not empty).xml?detail=custom:content,cenik&limit=0
Again, only attachments flagged for export to the e-shop are exported, and only those linked to a record in the e-shop. The custom detail level and limit=0 are used here as well. https://demo.flexibee.eu/c/demo/priloha/(exportNaEshop=true and cenik is not empty).xml ?detail=custom:content,cenik&limit=0
Working with the price list tree structure
It is also possible to transfer the hierarchical product category structure from Flexi to your e-shop. Retrieving this data requires two queries. The first query targets the tree register to obtain the complete tree structure.
GET /c/{firma}/strom/(strom='code:STR_CEN').xml?detail=full&limit=0
https://demo.flexibee.eu/c/demo/strom/(strom='code:STR_CEN').xml?detail=full&limit=0 The second query retrieves the relationships between individual price list records and the tree nodes.
GET /c/{firma}/strom-cenik.xml?detail=full&limit=0
https://demo.flexibee.eu/c/demo/strom-cenik.xml?detail=full&limit=0 Using the results of these two queries, you can reconstruct the complete Flexi tree structure in your e-shop. For records in the tree register, the most important element is otec (parent), which identifies the parent node of the node currently being processed. The root of the tree is identified by an empty otec element. The strom-cenik register contains the relationship between a price list record and a tree node. The idZaznamu element holds the internal Flexi identifier of the price list record. The node element is the identifier of the tree node. Remember that when retrieving the contents of a node, you must also include its child nodes :-).
Retrieving sales prices
Sales prices are a critical piece of data for any e-shop. For simple e-shops without complex pricing, you can use the cenaZaklBezDph and cenaZaklVcDph elements from the price list. The advantage is that no additional query to Flexi is needed. However, for most e-shops this approach eventually becomes insufficient.
If price list prices are not enough — for example, because certain customers who purchase frequently should receive discounts, or you want to assign a temporary "promotional price" to certain items — you will need to query the individual price list register.
This query takes into account the complex pricing logic in Flexi, making it possible to retrieve sales prices for a specific customer or customer group.
Flexi recommends defining a limited number of price groups and assigning individual customers to them based on the pricing they should receive. For example, you could create price groups GOLD, SILVER, BRONZE, and STANDARD. The GOLD group could then be set to receive a 20% discount off list prices, and so on. This reduces the number of queries to Flexi needed to obtain prices for all your e-shop customers to just 4 (one per group).
For online integrations, these queries are highly cacheable and do not need to be called repeatedly. If you want your e-shop to have different prices than your brick-and-mortar stores, it is a good idea to use cost centers in Flexi. Create cost centers for each of your locations and one labeled ESHOP. This way you can set different prices for the e-shop than for physical stores.
GET /c/{firma}/cenikova-skupina/code:GOLD/individualni-cenik.xml?date=datum výpočtu (výchozí je dnešek) ¤cy=požadovaná měna (např. EUR) ¢re=požadované středisko (zkratka, není povinná)
https://demo.flexibee.eu/c/demo/cenikova-skupina/code:GOLD/individualni-cenik.xml ?date=2017-01-01¤cy=EUR¢re=C Drawbacks of retrieving prices via the individual price list register. 1. Loading is slow — The query uses complex SQL with UNIONs. Do not paginate this query; cache it in the e-shop and update prices at night or during low-traffic periods. 2. The VAT rate is not shown as a number — Instead of the rate 21%, the result will contain only the rate identifier typSzbDph.dphZakl.
Checking stock levels
To check stock levels in Flexi, the stock-card register is used. This register can either be added as a relation to the price list query or retrieved with a separate query. If you want to load stock levels together with the price list, use the following query:
GET /c/{firma}/cenik.xml?relations=skladKarty
https://demo.flexibee.eu/c/demo/cenik.xml?relations=skladKarty From the collection of stock cards, you will need to filter out cards that are no longer current (i.e., those belonging to accounting periods other than the current one). A second option for retrieving stock levels is a standalone query to the stock-card register.
GET /c/{firma}/skladova-karta.xml
https://demo.flexibee.eu/c/demo/skladova-karta.xml This query has the advantage that you can filter out stock cards for outdated accounting periods directly in the query, so those irrelevant records do not need to be transferred from Flexi at all. Under no circumstances should you use the stav-skladu-k-datu register! That query is approximately as complex as the individual price list and is therefore computationally very expensive (again, it involves complex SQL).
Other required code lists
To create an order, you will most likely also need lists of shipping and payment methods. These can be retrieved from the following endpoints:
GET /c/{firma}/forma-dopravy.xml?detail=full&limit=0
GET /c/{firma}/forma-uhrady.xml?detail=full&limit=0
https://demo.flexibee.eu/c/demo/forma-uhrady.xml?detail=full&limit=0 Another useful register is price list attributes. If your products contain information that cannot be entered into standard Flexi fields, you can use attributes on the price list. A typical use case is the diagonal screen size for TVs and monitors. Attributes can be added as a relation when loading the price list, or accessed directly via a query to the attribute register.
GET /c/{firma}/atribut.xml?detail=full&limit=0
How to transfer orders from the e-shop to ABRA Flexi?

