The documentation exists and is very comprehensive (surprisingly well done) and is on the São Paulo Department of Finance . The documentation is in Legislação
, item Legislação em vigor
.
If you're reading the whole CAT-147 it's kind of tedious. Please download the PDFs from the Guidance Manual and the ER SAT (Requirements Specification). You will find them in Downloads
, item Arquivos vigentes
. Take a general exploration on the page and you'll start to form an idea of the thing.
Understand that in a single manual, there are two sides to the technical documentation. One is for SAT equipment manufacturers and another for systems developers (which they call AC, commercial application). In ER SAT , there is a table (item 4.2.2) that lists all the groups, elements, and attributes that compose the CF-e XML, and this will help you build this XML. The first column of this table is important because it indicates the source , who is responsible for providing that data. The lines indicated with AC
are the data generated by your application. The others will be filled in later by the SAT equipment.
The flow is simple:
Your application generates a simple XML, containing only the responsibility data of the CA, describing the sale;
This XML is sent to the SAT device through the function EnviarDadosVenda
;
The SAT device completes the XML, validates, signs and returns it to your application;
Your application issues the extract based on the XML data, which is called CF-e-SAT (whose signature makes it a legally valid fiscal document).
You said you do not want to use third-party libraries, but nothing prevents you from checking for other implementations to help you understand the whole thing.
I would put more links, but I have no "reputation" for this:)