Tangential curiosity: how is this part done? Do you download the keys from a government website? How do they handle key reissues if a private key is compromised?
It's a somewhat tedious process, but if you keep the key safe, which they very much advice, most of the procedures, including tax fillings, are pretty easy and fast.
So if the doctor's office punches in my legal ID number with the receipt (or if the ID gets added automatically from the billing system that a large hospital would have), then when the office sends all their receipt files to the tax office, the tax office will automatically add that electronic receipt to my tax deduction.
When that happens they ask you for your TAX ID and then the business generates the invoice and your taxid and their taxid makes the tie. The Mexican IRS systems see all of this. So at the tax reporting moment, the system will have all that info.
It is pretty neat actually. However I think it is possible bc in Mexico people are not that concerned with privacy and all that.
All invoices are digital. Every person who gets a TaxId also gets a Private/Public keypair and generating invoices means signing the document with that key. The amazing thing is that now accountants talk about the XML, which is the legal representation of the invoice.
As a result, every year if you file your taxes, you go I to the government freely provided website , get into your account and most of the data is there for the exercise, including deducted money that you can get back.
If you are a standard worker earning less than certain amount (very sensible, so the vast majority of workers fall in there) you don't even have to file your taxes.
That's one thing that is good about this country.