AlmondTill/G3N API

Take a return and refund it

Create the return, take the goods back — sellable or damaged as received — approve it, pay the customer back on the original method where possible, and close it. At the till with a receipt, one step does the whole walk.

Selling · a play in 5 steps.

The steps

  1. Create the return. — createReturn
  2. Take the goods back — stock returns bucketed as you receive it. — receiveReturn
  3. Approve it — the approval names you. — approveReturn
  4. Pay the customer back — money out, permanently — and close it. — refundReturn, closeReturn
  5. At the till, with a receipt: approve, receive and refund cash from the drawer in ONE step. — posReturn

The calls

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

createReturn

createReturn — mutation · Create a new customer return at your organization.

Example request

mutation ExampleCreateReturn($input: NewReturnInput!) {
  createReturn(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    invoiceId
    organizationId
    currency
    refundTotalMinor
  }
}

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "orderId": "01900000-0000-7000-8000-f6d8263a0000",
    "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
    "lines": [
      {
        "orderLineNo": 1,
        "quantity": "2",
        "reason": "Correcting a miscount."
      }
    ]
  }
}

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

Example response

{
  "data": {
    "createReturn": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RT-EXMP-0000-000F",
      "type": "Return",
      "caption": "Blue jeans",
      "status": "requested",
      "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",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "invoiceId": "01900000-0000-7000-8000-504ef4ed0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "refundTotalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

receiveReturn

receiveReturn — mutation · Take returned goods physically back in.

Example request

mutation ExampleReceiveReturn($input: ReceiveReturnInput!) {
  receiveReturn(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    invoiceId
    organizationId
    currency
    refundTotalMinor
  }
}

Variables:

{
  "input": {
    "returnId": "01900000-0000-7000-8000-4d4c03d20000",
    "expectedRevision": "01900000-0000-7000-8000-e02b2e6c0000",
    "dispositions": [
      {
        "lineNo": 1,
        "disposition": "restock",
        "quantity": "2",
        "reason": "Correcting a miscount."
      }
    ]
  }
}

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

Example response

{
  "data": {
    "receiveReturn": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RT-EXMP-0000-000F",
      "type": "Return",
      "caption": "Blue jeans",
      "status": "requested",
      "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",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "invoiceId": "01900000-0000-7000-8000-504ef4ed0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "refundTotalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

approveReturn

approveReturn — mutation · Approve a customer return — your sign-off moves it forward.

Example request

mutation ExampleApproveReturn($id: ID!, $revision: ID!, $reason: String) {
  approveReturn(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    invoiceId
    organizationId
    currency
    refundTotalMinor
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "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

{
  "data": {
    "approveReturn": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RT-EXMP-0000-000F",
      "type": "Return",
      "caption": "Blue jeans",
      "status": "requested",
      "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",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "invoiceId": "01900000-0000-7000-8000-504ef4ed0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "refundTotalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

refundReturn

refundReturn — mutation · Pay the customer back for an approved, received return.

Example request

mutation ExampleRefundReturn($input: RefundReturnInput!) {
  refundReturn(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    invoiceId
    organizationId
    currency
    refundTotalMinor
  }
}

Variables:

{
  "input": {
    "returnId": "01900000-0000-7000-8000-4d4c03d20000",
    "expectedRevision": "01900000-0000-7000-8000-e02b2e6c0000",
    "method": "original_tender",
    "reference": "<reference>"
  }
}

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

Example response

{
  "data": {
    "refundReturn": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RT-EXMP-0000-000F",
      "type": "Return",
      "caption": "Blue jeans",
      "status": "requested",
      "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",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "invoiceId": "01900000-0000-7000-8000-504ef4ed0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "refundTotalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

closeReturn

closeReturn — mutation · Close a customer return — finish it.

Example request

mutation ExampleCloseReturn($id: ID!, $revision: ID!, $reason: String) {
  closeReturn(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    invoiceId
    organizationId
    currency
    refundTotalMinor
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "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

{
  "data": {
    "closeReturn": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RT-EXMP-0000-000F",
      "type": "Return",
      "caption": "Blue jeans",
      "status": "requested",
      "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",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "invoiceId": "01900000-0000-7000-8000-504ef4ed0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "refundTotalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

posReturn

posReturn — mutation · A with-receipt return at the till, in ONE step — approve, take the goods back, and refund cash from the drawer.

Example request

mutation ExamplePosReturn($input: PosReturnInput!) {
  posReturn(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    invoiceId
    organizationId
    currency
    refundTotalMinor
  }
}

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "orderId": "01900000-0000-7000-8000-f6d8263a0000",
    "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
    "lines": [
      {
        "orderLineNo": 1,
        "quantity": "2",
        "reason": "Correcting a miscount."
      }
    ],
    "dispositions": [
      {
        "lineNo": 1,
        "disposition": "restock",
        "quantity": "2",
        "reason": "Correcting a miscount."
      }
    ],
    "refund": {
      "method": "original_tender",
      "reference": "<reference>"
    }
  }
}

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

Example response

{
  "data": {
    "posReturn": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RT-EXMP-0000-000F",
      "type": "Return",
      "caption": "Blue jeans",
      "status": "requested",
      "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",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "invoiceId": "01900000-0000-7000-8000-504ef4ed0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "refundTotalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}