AlmondTill/G3N API

On this page

applyTender

mutation · in the family Selling

What it does

Take payment on a placed order — cash, card, or other tender.

APPLY one tender to a PLACED order: cash — roundedDue per the CASH_ROUNDING increments (the sale total NEVER changes); (collected − tip) ≥ roundedDue ⇒ SETTLING (applied = the EXACT remainder, change = collected − tip − roundedDue, the ± roundingDelta stamps); else PARTIAL (the deposit lane). external_card — the RECORDED capture (≤ the remainder EXACTLY; no drawer). card — the INTEGRATED lane. The cash/recorded lanes stay ONE transaction: the tender row + the Order tenderedNetMinor/tipTotalMinor/paymentState stamp (OCC) + for cash the cash_sale (+ change_given) entries + the drawerTotals stamp. A fully-tendered order refuses CONFLICT/OVER_TENDERED. Requires the unrestricted capability.

What happens

Records the payment against the order; cash lanes need an open till session and record change given.

Careful

This is the money moment of a sale. Over-tendering refuses; every tender is permanent and feeds the drawer’s expected totals.

Who may call it

Capability area: Selling — Ringing sales, serving customers and issuing invoices.

Arguments

NameTypeRequiredNotes
inputApplyTenderInput ApplyTenderInput!yesNo further notes.

Returns

Tender Tender! — ONE applied tender: FSM-LESS by ratified intent (SPEC_CATALOG / — status is always active; the lifecycle is its Payment / the money facts); sysId-LESS (the class); IMMUTABLE — reversal = a NEW refund tender row (negative appliedMinor), never an edit. Posted ONLY by applyTender, refundTender, and the refund writers (refundReturn/posReturn method=cash) — each in ONE transaction with the Order rollup stamp (+ the drawer entries for cash).

Example request

mutation ExampleApplyTender($input: ApplyTenderInput!) {
  applyTender(input: $input) {
    id
    type
    caption
    status
    parentId
    rootId
    tenderType
    appliedMinor
    currency
    collectedMinor
    changeMinor
    tipMinor
    roundingDeltaMinor
    paymentId
    instrumentId
    orgCustomerId
    returnId
    tillSessionId
    reason
    refs
    createdAt
    updatedAt
    revision
    revisionNum
  }
}

Variables:

{
  "input": {
    "orderId": "01900000-0000-7000-8000-f6d8263a0000",
    "expectedRevision": "01900000-0000-7000-8000-e02b2e6c0000",
    "tenderType": "cash",
    "collectedMinor": 1,
    "collectedCurrency": "<collected currency>"
  }
}

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

Example response

{
  "data": {
    "applyTender": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "type": "<type>",
      "caption": "Blue jeans",
      "status": "<status>",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "tenderType": "cash",
      "appliedMinor": 1,
      "currency": "USD",
      "collectedMinor": 1,
      "changeMinor": 1,
      "tipMinor": 1,
      "roundingDeltaMinor": 1,
      "paymentId": "01900000-0000-7000-8000-a7c488a40000",
      "instrumentId": "01900000-0000-7000-8000-736f3dcd0000",
      "orgCustomerId": "01900000-0000-7000-8000-ba56ff800000",
      "returnId": "01900000-0000-7000-8000-4d4c03d20000",
      "tillSessionId": "01900000-0000-7000-8000-83d61fef0000",
      "reason": "Correcting a miscount.",
      "refs": [
        "<refs>"
      ],
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "revisionNum": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in