# Send goods back to a supplier

Raise the return-to-vendor, approve it, ship it — stock leaves your books when it ships — and record the supplier’s credit, the money side of sending goods back.

Procurement · a play in 4 steps.

## The steps

1. Raise the return-to-vendor — the goods going back. — [createRtv](/reference/purchasing/createRtv/)
2. Approve it before it ships. — [approveRtv](/reference/document-approvals/approveRtv/)
3. Ship it — stock leaves your books. — [shipRtv](/reference/purchasing/shipRtv/)
4. Record the supplier’s credit. — [recordRtvCredit](/reference/purchasing/recordRtvCredit/)

## The calls

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

### createRtv

[createRtv](/reference/purchasing/createRtv/) — mutation · Create a new return-to-vendor — goods going back to a supplier at your organization.

**Example request**

```graphql
mutation ExampleCreateRtv($input: CreateRtvInput!) {
  createRtv(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    purchaseOrderId
    shipFromLogicalFacilityId
    creditVarianceAcknowledged
    resolvedReturnsContactId
  }
}
```

Variables:

```json
{
  "input": {
    "caption": "Blue jeans",
    "orgVendorId": "01900000-0000-7000-8000-f885fa720000",
    "shipFromLogicalFacilityId": "01900000-0000-7000-8000-edd14c5a0000",
    "lines": [
      {
        "variantId": "01900000-0000-7000-8000-8415e73b0000",
        "quantity": "2",
        "reason": "defective",
        "sourceBucket": "on_hand"
      }
    ]
  }
}
```

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

**Example response**

```json
{
  "data": {
    "createRtv": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RV-EXMP-0000-000F",
      "type": "Rtv",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "purchaseOrderId": "01900000-0000-7000-8000-54a5b8570000",
      "shipFromLogicalFacilityId": "01900000-0000-7000-8000-edd14c5a0000",
      "creditVarianceAcknowledged": true,
      "resolvedReturnsContactId": "01900000-0000-7000-8000-6fed6ee50000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### approveRtv

[approveRtv](/reference/document-approvals/approveRtv/) — mutation · Approve a return-to-vendor before it ships.

**Example request**

```graphql
mutation ExampleApproveRtv($id: ID!, $revision: ID!, $reason: String) {
  approveRtv(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    purchaseOrderId
    shipFromLogicalFacilityId
    creditVarianceAcknowledged
    resolvedReturnsContactId
  }
}
```

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": {
    "approveRtv": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RV-EXMP-0000-000F",
      "type": "Rtv",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "purchaseOrderId": "01900000-0000-7000-8000-54a5b8570000",
      "shipFromLogicalFacilityId": "01900000-0000-7000-8000-edd14c5a0000",
      "creditVarianceAcknowledged": true,
      "resolvedReturnsContactId": "01900000-0000-7000-8000-6fed6ee50000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### shipRtv

[shipRtv](/reference/purchasing/shipRtv/) — mutation · Ship a return-to-vendor — the goods leave your stock back to the supplier.

**Example request**

```graphql
mutation ExampleShipRtv($id: ID!, $revision: ID!, $reason: String) {
  shipRtv(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    purchaseOrderId
    shipFromLogicalFacilityId
    creditVarianceAcknowledged
    resolvedReturnsContactId
  }
}
```

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": {
    "shipRtv": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RV-EXMP-0000-000F",
      "type": "Rtv",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "purchaseOrderId": "01900000-0000-7000-8000-54a5b8570000",
      "shipFromLogicalFacilityId": "01900000-0000-7000-8000-edd14c5a0000",
      "creditVarianceAcknowledged": true,
      "resolvedReturnsContactId": "01900000-0000-7000-8000-6fed6ee50000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### recordRtvCredit

[recordRtvCredit](/reference/purchasing/recordRtvCredit/) — mutation · Record the vendor’s credit for a return-to-vendor — the money side of sending goods back.

**Example request**

```graphql
mutation ExampleRecordRtvCredit($input: RecordRtvCreditInput!, $revision: ID!, $reason: String) {
  recordRtvCredit(input: $input, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    purchaseOrderId
    shipFromLogicalFacilityId
    creditVarianceAcknowledged
    resolvedReturnsContactId
  }
}
```

Variables:

```json
{
  "input": {
    "rtvId": "01900000-0000-7000-8000-3ccdf3720000",
    "actualCredit": {
      "currency": "USD",
      "amount": "10.00"
    },
    "acknowledgeVariance": true
  },
  "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": {
    "recordRtvCredit": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RV-EXMP-0000-000F",
      "type": "Rtv",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "purchaseOrderId": "01900000-0000-7000-8000-54a5b8570000",
      "shipFromLogicalFacilityId": "01900000-0000-7000-8000-edd14c5a0000",
      "creditVarianceAcknowledged": true,
      "resolvedReturnsContactId": "01900000-0000-7000-8000-6fed6ee50000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```
