AlmondTill/G3N API

Refund a payment

Refund a specific payment on an order — the record-only lane for cash and external tenders — and read the refunds as recorded.

Payments & fulfillment · a play in 2 steps.

In the office

Where it starts: the office’s Refunds page.

Step 1. Refund the payment — money out, recorded forever.

Step 2. Read the refunds — money going back to customers.

For developers — the calls

The steps

  1. Refund the payment — money out, recorded forever. — refundTender
  2. Read the refunds — money going back to customers. — refunds

The calls

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

refundTender

refundTender — mutation · Refund a specific payment on an order (the record-only lane for cash/external tenders).

Example request

graphql
mutation ExampleRefundTender($input: RefundTenderInput!) {
  refundTender(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:

json
{
  "input": {
    "orderId": "01900000-0000-7000-8000-18e782370000",
    "expectedRevision": "01900000-0000-7000-8000-e02b2e6c0000",
    "tenderType": "cash",
    "amountMinor": 1250,
    "tillSessionId": "01900000-0000-7000-8000-4ed885220000",
    "reason": "Correcting a miscount."
  }
}

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

Example response

json
{
  "data": {
    "refundTender": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "type": "<type>",
      "caption": "Blue jeans",
      "status": "<status>",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "tenderType": "cash",
      "appliedMinor": -1250,
      "currency": "USD",
      "collectedMinor": 1250,
      "changeMinor": 0,
      "tipMinor": 0,
      "roundingDeltaMinor": 0,
      "paymentId": null,
      "instrumentId": null,
      "orgCustomerId": null,
      "returnId": null,
      "tillSessionId": "01900000-0000-7000-8000-4ed885220000",
      "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-53c6eea90000",
      "revisionNum": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

refunds

refunds — query · The refund list — each entry is a refund — money going back to a customer.

Example request

graphql
query ExampleRefunds($filter: FilterInput) {
  refunds(filter: $filter) {
    items {
      id
      sysId
      type
      caption
      status
      parentId
      rootId
      createdAt
      updatedAt
      revisionNum
      revision
      organizationId
      orderId
      returnId
      amountMinor
      currency
      stripeAccountRef
      refundRef
      failureReason
    }
    nextToken
    matchCount
    matchCountExact
  }
}

Variables:

json
{
  "filter": {
    "clauses": [
      {
        "field": "caption",
        "op": "contains",
        "values": [
          "Blue"
        ]
      }
    ]
  }
}

Example response

json
{
  "data": {
    "refunds": {
      "items": [
        {
          "id": "01900000-0000-7000-8000-7900117f0000",
          "sysId": "RF-EXMP-0000-000F",
          "type": "Refund",
          "caption": "Blue jeans",
          "status": "created",
          "parentId": "01900000-0000-7000-8000-20f641110000",
          "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",
          "organizationId": "01900000-0000-7000-8000-1971e30a0000",
          "orderId": "01900000-0000-7000-8000-18e782370000",
          "returnId": "01900000-0000-7000-8000-cc01b1df0000",
          "amountMinor": -1250,
          "currency": "USD",
          "stripeAccountRef": "<stripe account ref>",
          "refundRef": "01900000-0000-7000-8000-e362bf900000",
          "failureReason": "<failure reason>"
        }
      ],
      "nextToken": "<the cursor from the previous page>",
      "matchCount": 1,
      "matchCountExact": true
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}