updateReturn

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Updates a single return.

Response

Return type UpdateReturnResponse

Arguments

ArgumentDescription
input (UpdateReturnInput required)

Represents the request information for updating a return.

Examples


Update Return With Return Delivery Offers

Request

mutation updateReturn {
  updateReturn(
    input: {
      returnIdentifier: {
        id: "return-id"
      },
      returnDeliveryGroups: [
        {
          returnDeliveryOffer: {
            details: {
              id: "return-delivery-offer-details-id"
            }
          }
        }
      ]
    }
  ) {
    returnDetails {
      id
      createdAt
      state
      returnDeliveryGroups {
        returnDeliveryOffer {
          details {
            id
            message {
              instructions {
                locale
                value
              }
            }
            returnDeliveryTerm {
              locator {
                locatorDisplayString {
                  value
                }
                url
              }
            }
          }
        }
      }
    }
  }
}

Response

{
  "data": {
    "updateReturn": {
      "returnDetails": {
        "id": "return-id",
        "createdAt": "2024-12-24T08:52:08.592403284Z",
        "state": "DRAFT",
        "returnDeliveryGroups": [
          {
            "returnDeliveryOffer": {
              "details": {
                "id": "753-081",
                "message": {
                  "instructions": [
                    {
                      "locale": "en-US",
                      "value": "Staples will pack, label, and ship your return for free. Just bring the item in its original packaging and disassemble it, if needed. We'll email you a return shipping code. Show it to an associate at any Staples store."
                    },
                    {
                      "locale": "en-US",
                      "value": "Printer not required."
                    }
                  ]
                },
                "returnDeliveryTerm": {
                  "locator": {
                    "locatorDisplayString": {
                      "value": "Choose dropoff location"
                    },
                    "url": ""
                  }
                }
              }
            }
          }
        ]
      }
    }
  }
}

Update Return With Aliases

Request

mutation updateReturn {
  updateReturn(
    input: {
      returnIdentifier: {
        id: "return-id"
      },
      aliases: [
        {
          aliasType: "EXTERNAL-RETURN-ID",
          aliasId: "external-return-id-1"
        }
      ]
    }
  ) {
    returnDetails {
      id
      createdAt
      state
      aliases {
        aliasType
        aliasId
      }
    }
  }
}

Response

{
  "data": {
    "updateReturn": {
      "returnDetails": {
        "id": "return-id",
        "createdAt": "2024-12-24T08:52:08.592403284Z",
        "state": "CREATED",
        "aliases": [
          {
            "aliasId": "external-return-id-1",
            "aliasType": "EXTERNAL-RETURN-ID"
          }
        ]
      }
    }
  }
}

Update Return Line Items With Return Reasons

Request

mutation updateReturn {
  updateReturn(
    input: {
      returnIdentifier: {
        id: "return-id"
      },
      returnLineItems: [
        {
          id: "3874-76351",
          returnReasonTermInput: {
            reasonCode: "CR-MISSED_ESTIMATED_DELIVERY"
          }
        }
      ]
    }
  ) {
    returnDetails {
      id
      createdAt
      state
      refundTerm {
        displayMessage {
          locale
          value
        }
        estimatedRefundTotal {
          totalAmount {
            amount
            currencyCode
          }
        }
        paymentTerms {
          type
        }
      }
      returnDeliveryGroups {
        returnDeliveryOfferOptions {
          details {
            id
          }
        }
        returnDeliveryOffer {
          details {
            id
          }
        }
      }
      returnLineItems {
        id
        returnReasonTerm {
          reasonCode
          description {
            locale
            value
          }
        }
      }
    }
  }
}

Response

{
  "data": {
    "updateReturn": {
      "returnDetails": {
        "id": "return-id",
        "createdAt": "2024-12-24T08:52:08.592403284Z",
        "state": "DRAFT",
        "refundTerm": {
          "displayMessage": {
            "locale": "en-US",
            "value": "Estimated refund"
          },
          "estimatedRefundTotal": {
            "totalAmount": {
              "amount": 1.00,
              "currencyCode": "USD"
            }
          },
          "paymentTerms": []
        },
        "returnDeliveryGroups": [
          {
            "returnDeliveryOfferOptions": [
              {
                "details": {
                  "id": "345-791"
                }
              },
              {
                "details": {
                  "id": "109-851"
                }
              },
              {
                "details": {
                  "id": "753-081"
                }
              },
              {
                "details": {
                  "id": "001-971"
                }
              },
              {
                "details": {
                  "id": "444-555"
                }
              }
            ],
            "returnDeliveryOffer": null
          }
        ],
        "returnLineItems": [
          {
            "id": "3874-76351",
            "returnReasonTerm": {
              "reasonCode": "CR-MISSED_ESTIMATED_DELIVERY",
              "description": {
                "locale": "en-US",
                "value": "Item arrived too late"
              }
            }
          }
        ]
      }
    }
}

Submit Return

Request

mutation updateReturn {
  updateReturn(
    input: {
      returnIdentifier: {
        id: "return-id"
      },
      desiredReturnExecutionState: STARTED
    }
  ) {
    returnDetails {
      id
      createdAt
      state
    }
  }
}

Response

{
  "data": {
    "updateReturn": {
      "returnDetails": {
        "id": "return-id",
        "createdAt": "2024-12-24T08:52:08.592403284Z",
        "state": "CREATED"
      }
    }
  }
}