- v3 · current
- v2.2 · deprecated
- v1 · deprecated
- v0 · deprecated
You are reading the current (v3) contract for
order.cancelled. v3 is a breaking change in the fiscal context only: cancellation.metadata.fiscal becomes cancellation.fiscal, structured as { status, authority }, and it now applies to every country with an authorized document, not only Brazil. cancellation.metadata is no longer emitted. The rest of the event is unchanged. See Path changes from the previous version.order.cancelled fires when a previously injected order is cancelled — from the Fire backoffice (cancellationSource: backoffice), or through an adapter or the cancellation API (cancellationSource: adapter). It does not retract a prior order.completed for the same order; both events are emitted independently.
Trigger condition
Fire emitsorder.cancelled once when an order transitions to CANCELLED, regardless of its previous payment state, with full audit context.
What’s in trigger.data
The same V4 order snapshot as order.completed, with four differences:
statusis"CANCELLED".paymentStatusis unchanged (typically"SUCCEEDED"if the order had been paid).- A top-level
cancellationblock carries the audit metadata and, when applicable, the fiscal document. - There is no top-level
data.fiscal. On this event the authority’s document lives only incancellation.fiscal.
policy and lastKnown travel exactly as on order.completed. fiscalRepresentation has the same shape, but when a credit note was numbered for the cancellation it carries that note on top and the invoice in history. In Brazil (PlugNotas) fiscalRepresentation is null: there is no numbering step. authority.providerIdentity and authority.providerMetadata appear on documents stored under this contract; on earlier orders the keys may be missing — treat a missing key like null.
Example — Brazil, with an authorized document (sanitized)
Example — without an authorized document
When the order had no authorized document (the authority had not answered yet, the store does not issue documents, or the document has no provider id), thefiscal key is absent — not null. Here, a store that does not number at the till, cancelled before the authority answered: fiscalRepresentation is null, lastKnown.fiscal still says processing, and cancellation has no fiscal. No order.reversed follows.
In countries that number at the till, an order cannot be cancelled while its invoice is still in force: Fire answers 409 (FISCAL_REPRESENTATION_NOT_VOIDED) until the credit note is requested. Once it is, the event carries fiscalRepresentation with the CREDIT_NOTE on top and the invoice in history.
if (data.cancellation.fiscal).
Blocks elided as same as
order.completed are byte-for-byte the snapshot order.completed carries. See the order.completed field reference.Cash fields in
payments.paymentMethods[]. customerCashAmount and changeAmount are numbers. Orders injected before 24 September 2026 carry customerCashAmount as the string "0" and no changeAmount: if you replay or reprocess older events, read the field as a number. See the order.completed field reference.data.cancellation reference
object
Audit block describing how, when and by whom the order was cancelled.
The fiscal block
For how each field of the fiscal callback lands here, see From the callback to the events. The fiscal block oforder.invoiced, order.cancelled and order.reversed is what Fire stored in the order, with the same shape. It is not rebuilt per emitter: whether the document came in through your fiscal provider’s native integration or through the fiscal callback, you read the same fields at the same depth.
Where it lives in each event
Fields of the block
string | null
The fiscal status of the order, not of one document:
awaiting_payment, not_issued, pending, processing, fiscal_graphic, authorized, cancelling, cancelled, rejected, denied, error. In practice order.invoiced carries authorized, order.reversed carries cancelled, and order.cancelled carries authorized or cancelling.string | null
ISO 3166-1 alpha-2 code of the regime that issued the document (
BR, CO, EC, CL, AR, VE). The country no longer lives in the event name: filter on this field.string | null
Fire’s identifier for the adapter that processed the document (
plugnotas, generic). It is ours, not the provider’s name.string | null
ISO 8601 UTC timestamp of the fiscal fact that fired the event, as reported by the provider.
object | null
The authority’s verdict on the current document. Fields that mean the same in every country sit at the top; the authority’s own identifiers sit in
countryData, in that country’s vocabulary.object[]
Every stop of the order’s fiscal journey that describes a document, oldest first — including the current one. On
order.invoiced it usually has one entry, equal to authority; on order.reversed it has the invoice and then the cancellation. Stops without a document block do not appear — for example the cancelling Fire records before asking the authority; a processing that already carries the till’s numbering does appear.This is not
fiscalRepresentation.history. That one lists only the previous documents of the numbering; this one is the full journey and ends with the current document.object | null
A pointer to the document the current one replaces. Present when the order’s fiscal status is
cancelled; null otherwise. It points at the last stop in history that is not itself a cancellation — look its documentNumber up there for the whole document.It carries no
reason, unlike fiscalRepresentation.compensates. The motive already travels in the same event, with more detail: cancellation.cancellationType, cancellationGroup, cancellationReason, cancellationNote and cancellationSource. Fire does not emit order.reversed without an operational cancellation record, so that block is always there when compensates is. A fixed ORDER_CANCELLATION code here would say the same thing with less information. The numbering block does carry a reason: it is where the canonical code is resolved into the wording printed on the credit note, which needs the company’s own text.In Brazil the pointer refers to the same number. SEFAZ does not number a new document to cancel one, so
compensates.documentNumber equals authority.documentNumber. That is correct, not a bug.countryData and the fiscal callback
countryData is one block with three names, depending on which side of Fire you look at:
What your provider sends in the callback’s
document is what you receive in authority.countryData, with the same key names. The rule that splits the two is exclusion: every key of the callback that is not a canonical field lands in countryData untouched. That is why a country’s new identifier travels without any change on Fire’s side.
The callback’s root fields become authority’s top-level fields with the same names, except the three amounts, which are grouped in amounts. provider and metadata become providerIdentity and providerMetadata (null when absent or empty). The field-by-field table is in From the callback to the events.
Brazil’s
protocolo lives in countryData, not at the top. Only SEFAZ has it — Chile has trackId, Argentina the cae — so it is the authority’s vocabulary, not a canonical field. Orders stored before this contract had it at the top as authorizationProtocol; Fire emits it as countryData.protocolo for those too.Path changes from the previous version
Every previous path has exactly one current path. The payload carries no version number: the version belongs to this documented contract.
Lifecycle relative to other events
order.cancelledis emitted immediately, before the authority is contacted.order.reversedfollows once the authority confirms — seconds or minutes later.- Without an authorized document, only
order.cancelledfires.
Handler example
Common pitfalls
- Read
cancellation.fiscal, notcancellation.metadata.fiscal. The previous path is empty on v3. cancellation.fiscalis the document before the annulment. For the authority’s confirmation, listen fororder.reversed.- Absent, not
null. Test the key’s presence; do not compare tonull. order.cancelledis not a refund. The refund, if any, is initiated by the channel or processor.- Don’t assume
order.completedarrived first. Tolerate anorder.cancelledfor an order you don’t know yet.
Related events
order.completed
The event you’ll see for the same order before cancellation.
order.reversed
Fires when the authority confirms the document’s cancellation.
data.fiscalRepresentation
Unchanged in v3. It is the fiscal numbering printed at the till, a different block from cancellation.fiscal: it never says the document was authorized. When a cancellation numbers a credit note, that note sits on top and the invoice moves into fiscalRepresentation.history. It is the same block as on order.completed — field reference in order.completed → data.fiscalRepresentation.
data.policy and data.lastKnown
Unchanged in v3 and identical to every order event. lastKnown.fiscal.status is the order’s current fiscal state and is advisory — never gate an irreversible action on it. Reference in order.completed → data.policy and data.lastKnown.
