AlmondTill/G3N API

Sell and redeem gift cards and store credit

Create the money-like instrument, turn it on so it can be sold and redeemed, look a card up at the till by its number, and correct a balance with a reason when you must — every entry stays on the ledger.

Pricing & money · a play in 4 steps.

The steps

  1. Create the gift card or store-credit instrument. — createStoredValueInstrument
  2. Turn it on — it becomes live at the till and online. — activateStoredValueInstrument
  3. Look a card up by its number before redeeming — balance and state. — resolveStoredValueInstrument
  4. Correct a balance with a reason — a permanent, audited entry — and read the instrument’s full money story. — adjustStoredValueInstrument, storedValueLedger

The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

createStoredValueInstrument

createStoredValueInstrument — mutation · Create a new gift card or store-credit instrument — customer-held, money-like at your organization.

Example request

mutation ExampleCreateStoredValueInstrument($input: NewStoredValueInstrumentInput!) {
  createStoredValueInstrument(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    instrumentType
    code
    reloadable
    balanceMinor
    currency
  }
}

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "organizationId": "01900000-0000-7000-8000-44b781470000",
    "instrumentType": "gift_card"
  }
}

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

Example response

{
  "data": {
    "createStoredValueInstrument": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SV-EXMP-0000-000F",
      "type": "StoredValueInstrument",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "instrumentType": "gift_card",
      "code": "BJ-001",
      "reloadable": true,
      "balanceMinor": 1,
      "currency": "USD"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

activateStoredValueInstrument

activateStoredValueInstrument — mutation · Turn on a gift card or store-credit instrument so it can be sold and redeemed.

Example request

mutation ExampleActivateStoredValueInstrument($input: ActivateStoredValueInstrumentInput!) {
  activateStoredValueInstrument(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    instrumentType
    code
    reloadable
    balanceMinor
    currency
  }
}

Variables:

{
  "input": {
    "instrumentId": "01900000-0000-7000-8000-736f3dcd0000",
    "expectedRevision": "01900000-0000-7000-8000-e02b2e6c0000",
    "amountMinor": 1,
    "reason": "Correcting a miscount."
  }
}

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

Example response

{
  "data": {
    "activateStoredValueInstrument": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SV-EXMP-0000-000F",
      "type": "StoredValueInstrument",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "instrumentType": "gift_card",
      "code": "BJ-001",
      "reloadable": true,
      "balanceMinor": 1,
      "currency": "USD"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

resolveStoredValueInstrument

resolveStoredValueInstrument — query · Look up a gift card or store credit by its number — balance and state, the till’s check before redeeming.

Example request

query ExampleResolveStoredValueInstrument($code: String!) {
  resolveStoredValueInstrument(code: $code) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    instrumentType
    code
    reloadable
    balanceMinor
    currency
  }
}

Variables:

{
  "code": "BJ-001"
}

Example response

{
  "data": {
    "resolveStoredValueInstrument": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SV-EXMP-0000-000F",
      "type": "StoredValueInstrument",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "instrumentType": "gift_card",
      "code": "BJ-001",
      "reloadable": true,
      "balanceMinor": 1,
      "currency": "USD"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

adjustStoredValueInstrument

adjustStoredValueInstrument — mutation · Manually correct a gift card or store-credit balance, with a reason.

Example request

mutation ExampleAdjustStoredValueInstrument($instrumentId: ID!, $revision: ID!, $amountMinor: Int!, $reason: String!) {
  adjustStoredValueInstrument(instrumentId: $instrumentId, revision: $revision, amountMinor: $amountMinor, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    instrumentType
    code
    reloadable
    balanceMinor
    currency
  }
}

Variables:

{
  "instrumentId": "01900000-0000-7000-8000-736f3dcd0000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "amountMinor": 1,
  "reason": "Correcting a miscount."
}

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

Example response

{
  "data": {
    "adjustStoredValueInstrument": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SV-EXMP-0000-000F",
      "type": "StoredValueInstrument",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "instrumentType": "gift_card",
      "code": "BJ-001",
      "reloadable": true,
      "balanceMinor": 1,
      "currency": "USD"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

storedValueLedger

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

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
        }
      }
    }
  }
}