AlmondTill/G3N API

doomStoredValueInstrument

mutation · in the family Stored value instrument

What it does

Permanently retire a gift card or store-credit instrument — customer-held, money-like.

Doom (terminal) a StoredValueInstrument by id, within the caller's org group; requires the unrestricted capability + the record's current revision. Gated by CONFLICT/BALANCE_OUTSTANDING while balanceMinor ≠ 0. The code marker stays burned forever.

Before you call

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

Capability area: Till and cash management — Manual drawer entries and force-closing a till.

Roles that may call it:

Careful

Doom is forever — a doomed record never comes back into use (its history remains readable). Anything still referencing it live will block the doom.

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

StoredValueInstrument StoredValueInstrument! — A StoredValueInstrument — a balance-bearing money instrument: gift_card (purchasable, reloadable-by-field, bearer) · gift_certificate (fixed-amount) · store_credit (refund/goodwill-born, customer-BOUND, never purchasable as a line). Dual-birth: immediate active (the issue entry rides the create) or staged inactive printed stock (activated at sale via the Order line arm, or directly via activateStoredValueInstrument). Selling/reloading one is an Order line (untaxed — basis instrument_sale; engine-invisible); redeeming one is an applyTender step-5 internal tender; store credit from a return mints via refundReturn method=store_credit. Doom is gated by CONFLICT/BALANCE_OUTSTANDING while value remains (zero via reason-coded adjust first — no silent money destruction).

Example request

graphql
mutation ExampleDoomStoredValueInstrument($id: ID!, $revision: ID!, $reason: String) {
  doomStoredValueInstrument(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    instrumentType
    code
    reloadable
    balanceMinor
    currency
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-713d7f020000",
  "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": {
    "doomStoredValueInstrument": {
      "id": "01900000-0000-7000-8000-713d7f020000",
      "sysId": "SV-EXMP-0000-000F",
      "type": "StoredValueInstrument",
      "caption": "Blue jeans",
      "status": "doomed",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "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",
      "instrumentType": "gift_card",
      "code": "BJ-001",
      "reloadable": true,
      "balanceMinor": 1250,
      "currency": "USD"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer