Numbering a sale
The request is the same for both countries —same fields, same order—; what changes is what each provider uses and what it returns indocument. The bodies below are trimmed to
what you need to read the example; the full request, field by field, is in the
contract.
- Ecuador (EC) — SRI
- Colombia (CO) — DIAN
What we send
storeFiscalConfig.metadata travels empty: in Ecuador the establishment and the point of
emission are resolved on your side against your catalog, from store.code and device.uid.What the provider returned
documentspeaks Ecuadorian.claveAcceso,secuencial,ambiente— the SRI’s names, not a translation. And there are no fields from other countries: the Colombiancufesimply does not exist here.- The visible number arrives already assembled in
numeroComprobante(005-004-000000052). You compose it, because you know the rule —art. 18 of the Regulation— and FIRE prints it as is, without reformatting. The three pieces still travel separately, as the SRI defines them, but they are for reconciliation: nobody joins them back together. graphic.qrmatchesdocument.claveAcceso. In Ecuador that is how it works, and the redundancy is deliberate: the alternative is for the point of sale to know what gets encoded in each country.ambiente: "2"means testing — at the SRI. At the DIAN the2is the other way around; see the Colombia tab.
accountId, no vendorId —the tenant
comes from the API key—, no tax authority codes, no reference to the provider’s catalog.
And two things common to both countries:
authorizationModeandissuedAtsit at the root, outsidedocument: they are common to every country, so they do not belong in the country block.status: "INVOICED", not"PENDING". Right after numbering, a document is always pending authorization — that is the normal condition, not a state to report.
When it fails
The same request, with the store outside the provider’s catalog
The same request, with something broken on your side
Missing configuration does NOT belong here. A store with no fiscal identity, no numbering
resolution or no technical key will fail exactly the same in a week: that is the
422 above,
with retryable: false. 5xx is only for what can start working on its own later.What we do with each response
The state FIRE exposes to its channels is derived from what the provider returns. The provider does not know these states and does not have to emit them:PENDING cannot come from the provider by definition: stating it would imply having
answered. It is the “there was no response” state, and it is the most delicate one — the
provider may have numbered and consumed a sequential without us finding out.That is why your deduplication has to be by orderCode: the retry arrives with the same
orderCode and must return the same document with reused: true, instead of numbering another one.
