# 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](/reference/return/createReturn/)
2. Take the goods back — stock returns bucketed as you receive it. — [receiveReturn](/reference/gated-floor-actions/receiveReturn/)
3. Approve it — the approval names you. — [approveReturn](/reference/return/approveReturn/)
4. Pay the customer back — money out, permanently — and close it. — [refundReturn](/reference/refunds-and-payment-corrections/refundReturn/), [closeReturn](/reference/return/closeReturn/)
5. At the till, with a receipt: approve, receive and refund cash from the drawer in ONE step. — [posReturn](/reference/register-approvals/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](/reference/return/createReturn/) — mutation · Create a new customer return at your organization.

**Example request**

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

Variables:

```json
{
  "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**

```json
{
  "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](/reference/gated-floor-actions/receiveReturn/) — mutation · Take returned goods physically back in.

**Example request**

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

Variables:

```json
{
  "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**

```json
{
  "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](/reference/return/approveReturn/) — mutation · Approve a customer return — your sign-off moves it forward.

**Example request**

```graphql
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:

```json
{
  "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**

```json
{
  "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](/reference/refunds-and-payment-corrections/refundReturn/) — mutation · Pay the customer back for an approved, received return.

**Example request**

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

Variables:

```json
{
  "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**

```json
{
  "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](/reference/return/closeReturn/) — mutation · Close a customer return — finish it.

**Example request**

```graphql
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:

```json
{
  "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**

```json
{
  "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](/reference/register-approvals/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**

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

Variables:

```json
{
  "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**

```json
{
  "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
        }
      }
    }
  }
}
```
