AlmondTill/G3N API

On this page

storedValueLedger

query · in the family Reading your records

What it does

A gift card / store credit’s full money story — every load and redemption.

The StoredValueEntry ledger of ONE instrument, NEWEST-FIRST + bounded: 'limit' clamps server-side; 'before' = the prior page's oldest entry id (exclusive). With the instrument GET (cached balanceMinor — stamped in the SAME transaction as every entry) this IS the balance story. Requires authentication; the instrument is tenant-scoped server-side.

What happens

Reads only.

Who may call it

Capability area: Reading your records — Looking up and listing the records of your organization.

Arguments

NameTypeRequiredNotes
instrumentIdID ID!yesNo further notes.
limitIntnoHow many records to answer at most; a page may hold fewer.
beforeIDnoNo further notes.

Returns

StoredValueEntry [StoredValueEntry!]! — ONE immutable stored-value balance fact: the signed amountMinor IS the balance direction; the parent instrument's balanceMinor was stamped in the SAME transaction. Corrections are NEW adjust entries, never edits.

Example request

query ExampleStoredValueLedger($instrumentId: ID!, $limit: Int) {
  storedValueLedger(instrumentId: $instrumentId, limit: $limit) {
    id
    parentId
    entryType
    amountMinor
    currency
    reason
    orderId
    tenderId
    returnId
    caption
    createdAt
  }
}

Variables:

{
  "instrumentId": "01900000-0000-7000-8000-736f3dcd0000",
  "limit": 1
}

Example response

{
  "data": {
    "storedValueLedger": [
      {
        "id": "01900000-0000-7000-8000-37386ae00000",
        "parentId": "01900000-0000-7000-8000-065235280000",
        "entryType": "issue",
        "amountMinor": 1,
        "currency": "USD",
        "reason": "Correcting a miscount.",
        "orderId": "01900000-0000-7000-8000-f6d8263a0000",
        "tenderId": "01900000-0000-7000-8000-0ae1978a0000",
        "returnId": "01900000-0000-7000-8000-4d4c03d20000",
        "caption": "Blue jeans",
        "createdAt": "2027-01-31T00:00:00.000Z"
      }
    ]
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in