return Decline Requestmutation
Requires write
access scope or write
access scope. Also: Requires the write
access scope. The user must have return
permission.
Declines a return on an order.
When a return is declined, each Return
can be associated to a new return.
Use the Return
or Return
mutation to initiate a new return.
Arguments
The input fields for declining a customer's return request.
ReturnDeclineRequestPayload returns
The declined return.
The list of errors that occurred from executing the mutation.
Code examples for MUTATION: returnDeclineRequest
Query Reference for MUTATION: returnDeclineRequest
"mutation returnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n # Return fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: returnDeclineRequest
"{\n \"input\": {\n \"declineNote\": \"<your-declineNote>\",\n \"declineReason\": \"FINAL_SALE\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"notifyCustomer\": true\n }\n}"
Schema Reference for MUTATION: returnDeclineRequest
"input ReturnDeclineRequestInput {\n declineNote: String\n declineReason: ReturnDeclineReason!\n id: ID!\n notifyCustomer: Boolean\n}\n"
Display Examples for MUTATION: returnDeclineRequest
[ { "example": { "type_name": "returndeclinerequest", "title": "Cannot decline a return that has been refunded", "description": "Mutation fails if the return was already refunded.\n", "query_string": "mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n}", "variables": { "input": { "id": "gid://shopify/Return/491427904", "declineReason": "RETURN_PERIOD_ENDED" } }, "response": { "data": { "returnDeclineRequest": { "return": null, "userErrors": [ { "code": "INVALID_STATE", "field": [ "input", "id" ], "message": "Return is not declinable. Only non-refunded returns with status REQUESTED can be declined." } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/returns/test/unit/graph_api/admin/mutations/return_decline_request_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) { returnDeclineRequest(input: $input) { return { id status } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/491427904\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/491427904\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/491427904\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/491427904\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/491427904\",\n \"declineReason\" => \"RETURN_PERIOD_ENDED\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The input fields for declining a customer's return request.", "type": { "kind": "INPUT_OBJECT", "name": "ReturnDeclineRequestInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ReturnDeclineRequestInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Return/491427904\",\"declineReason\":\"RETURN_PERIOD_ENDED\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "returndeclinerequest", "title": "Cannot decline a return with an invalid status", "description": "Mutation fails if the return status is `OPEN`.\n", "query_string": "mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n}", "variables": { "input": { "id": "gid://shopify/Return/945000954", "declineReason": "RETURN_PERIOD_ENDED" } }, "response": { "data": { "returnDeclineRequest": { "return": null, "userErrors": [ { "code": "INVALID_STATE", "field": [ "input", "id" ], "message": "Return is not declinable. Only non-refunded returns with status REQUESTED can be declined." } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/returns/test/unit/graph_api/admin/mutations/return_decline_request_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) { returnDeclineRequest(input: $input) { return { id status } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000954\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000954\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000954\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000954\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/945000954\",\n \"declineReason\" => \"RETURN_PERIOD_ENDED\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The input fields for declining a customer's return request.", "type": { "kind": "INPUT_OBJECT", "name": "ReturnDeclineRequestInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ReturnDeclineRequestInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Return/945000954\",\"declineReason\":\"RETURN_PERIOD_ENDED\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "returndeclinerequest", "title": "Decline a return", "description": "Decline a return for the order.\n", "query_string": "mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n decline {\n reason\n }\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}", "variables": { "input": { "id": "gid://shopify/Return/945000960", "declineReason": "RETURN_PERIOD_ENDED" } }, "response": { "data": { "returnDeclineRequest": { "return": { "id": "gid://shopify/Return/945000960", "status": "DECLINED", "decline": { "reason": "RETURN_PERIOD_ENDED" }, "returnLineItems": { "edges": [ { "node": { "id": "gid://shopify/ReturnLineItem/677614677" } } ] }, "order": { "id": "gid://shopify/Order/625362839" } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/returns/test/unit/graph_api/admin/mutations/return_decline_request_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) { returnDeclineRequest(input: $input) { return { id status decline { reason } returnLineItems(first: 1) { edges { node { id } } } order { id } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000960\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n decline {\n reason\n }\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000960\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n decline {\n reason\n }\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000960\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n decline {\n reason\n }\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000960\",\n \"declineReason\": \"RETURN_PERIOD_ENDED\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {\n returnDeclineRequest(input: $input) {\n return {\n id\n status\n decline {\n reason\n }\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/945000960\",\n \"declineReason\" => \"RETURN_PERIOD_ENDED\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The input fields for declining a customer's return request.", "type": { "kind": "INPUT_OBJECT", "name": "ReturnDeclineRequestInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ReturnDeclineRequestInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Return/945000960\",\"declineReason\":\"RETURN_PERIOD_ENDED\"}", "typeKind": "MUTATION" } ] } ]