AlmondTill/G3N API

voidInvoice

mutation · in the family Invoice

What it does

Void an invoice — the billing document of a sale — cancel it as if it should not have happened, keeping the paper trail.

Void an issued Invoice. The order's invoicedQty rollups un-stamp in THE transaction and the invoiceIds slot is removed; an invoice carrying non-voided CreditNotes/DebitNotes refuses CONFLICT/REFERENCED (void the notes first). Requires the unrestricted capability + the record's current revision. Terminal doomed-class — lists filter it.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Refunds and payment corrections — Refunds, corrective notes and voiding invoices.

Roles that may call it:

Careful

Voiding is permanent and always auditable.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
reasonStringno

Concurrency

Send the record’s current revision from your last read as revision. A stale revision is refused as CONFLICT/REVISION_STALE — read the record again and retry with the new value.

Returns

Invoice Invoice! — A sales Invoice — the billing/revenue-recognition document generated from an Order: an immutable line snapshot at issue (captured prices/discounts/tax copy, telescoping-prorated exactly for the 1..N partial model — a full invoicing sums to the order figures exactly). One order → one-or-many invoices. Born issued by the bespoke issueInvoice op; corrections are NEW CreditNote/DebitNote documents, never an edit — no update surface exists. The GAAP recognition trail is reports-only; the three rollup vectors are animated derived read-models.

Example request

graphql
mutation ExampleVoidInvoice($id: ID!, $revision: ID!, $reason: String) {
  voidInvoice(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    organizationId
    currency
    taxMode
    taxJurisdictionId
    paymentState
    fulfillmentState
    recognitionState
    subtotalMinor
    discountTotalMinor
    taxTotalMinor
    totalMinor
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-71ec87b00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "voidInvoice": {
      "id": "01900000-0000-7000-8000-71ec87b00000",
      "sysId": "IN-EXMP-0000-000F",
      "type": "Invoice",
      "caption": "Blue jeans",
      "status": "voided",
      "parentId": "01900000-0000-7000-8000-10c08c590000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "orderId": "01900000-0000-7000-8000-18e782370000",
      "organizationId": "01900000-0000-7000-8000-1971e30a0000",
      "currency": "USD",
      "taxMode": "exclusive",
      "taxJurisdictionId": "01900000-0000-7000-8000-33d0df4f0000",
      "paymentState": "<payment state>",
      "fulfillmentState": "<fulfillment state>",
      "recognitionState": "<recognition state>",
      "subtotalMinor": 1250,
      "discountTotalMinor": 0,
      "taxTotalMinor": 0,
      "totalMinor": 1250
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer