draft Order Invoice Sendmutation
mutation
2024-10latest
Requires write
access scope. Also: The user must have access to manage draft orders.
Sends an email invoice for a draft order.
Arguments
Specifies the draft order invoice email fields.
Specifies the draft order to send the invoice for.
Was this section helpful?
DraftOrderInvoiceSendPayload returns
The draft order an invoice email is sent for.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: draftOrderInvoiceSend
Query Reference for MUTATION: draftOrderInvoiceSend
"mutation draftOrderInvoiceSend($id: ID!) {\n draftOrderInvoiceSend(id: $id) {\n draftOrder {\n # DraftOrder fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: draftOrderInvoiceSend
"{\n \"email\": {\n \"bcc\": [\n \"<your-bcc>\"\n ],\n \"body\": \"<your-body>\",\n \"customMessage\": \"<your-customMessage>\",\n \"from\": \"<your-from>\",\n \"subject\": \"<your-subject>\",\n \"to\": \"<your-to>\"\n },\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: draftOrderInvoiceSend
"input EmailInput {\n bcc: [String!]\n body: String\n customMessage: String\n from: String\n subject: String\n to: String\n}\n"
Display Examples for MUTATION: draftOrderInvoiceSend
[ { "example": { "type_name": "draftorderinvoicesend", "title": "Send a draft order invoice by draft order ID", "query_string": "mutation draftOrderInvoiceSend($id: ID!) {\n draftOrderInvoiceSend(id: $id) {\n draftOrder {\n id\n }\n }\n}", "variables": { "id": "gid://shopify/DraftOrder/276395349" }, "response": { "data": { "draftOrderInvoiceSend": { "draftOrder": { "id": "gid://shopify/DraftOrder/276395349" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/draft_orders/test/unit/graph_api/admin/mutations/draft_order_invoice_send_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 draftOrderInvoiceSend($id: ID!) { draftOrderInvoiceSend(id: $id) { draftOrder { id } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DraftOrder/276395349\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation draftOrderInvoiceSend($id: ID!) {\n draftOrderInvoiceSend(id: $id) {\n draftOrder {\n id\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DraftOrder/276395349\"\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 draftOrderInvoiceSend($id: ID!) {\n draftOrderInvoiceSend(id: $id) {\n draftOrder {\n id\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DraftOrder/276395349\"\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 draftOrderInvoiceSend($id: ID!) {\n draftOrderInvoiceSend(id: $id) {\n draftOrder {\n id\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DraftOrder/276395349\"\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 draftOrderInvoiceSend($id: ID!) {\n draftOrderInvoiceSend(id: $id) {\n draftOrder {\n id\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DraftOrder/276395349\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "Specifies the draft order to send the invoice for.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/DraftOrder/276395349\"", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "draftorderinvoicesend", "title": "Sending an invoice with invalid arguments returns an error", "query_string": "mutation draftOrderInvoiceSend($id: ID!, $email: EmailInput) {\n draftOrderInvoiceSend(id: $id, email: $email) {\n draftOrder {\n id\n }\n userErrors {\n message\n field\n }\n }\n}", "variables": { "id": "gid://shopify/DraftOrder/276395349", "email": { "subject": "valid subject", "to": "invalid recipient" } }, "response": { "data": { "draftOrderInvoiceSend": { "draftOrder": { "id": "gid://shopify/DraftOrder/276395349" }, "userErrors": [ { "message": "To is invalid", "field": null } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/draft_orders/test/unit/graph_api/admin/mutations/draft_order_invoice_send_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 draftOrderInvoiceSend($id: ID!, $email: EmailInput) { draftOrderInvoiceSend(id: $id, email: $email) { draftOrder { id } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DraftOrder/276395349\",\n \"email\": {\n \"subject\": \"valid subject\",\n \"to\": \"invalid recipient\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation draftOrderInvoiceSend($id: ID!, $email: EmailInput) {\n draftOrderInvoiceSend(id: $id, email: $email) {\n draftOrder {\n id\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DraftOrder/276395349\",\n \"email\": {\n \"subject\": \"valid subject\",\n \"to\": \"invalid recipient\"\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 draftOrderInvoiceSend($id: ID!, $email: EmailInput) {\n draftOrderInvoiceSend(id: $id, email: $email) {\n draftOrder {\n id\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DraftOrder/276395349\",\n \"email\": {\n \"subject\": \"valid subject\",\n \"to\": \"invalid recipient\"\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 draftOrderInvoiceSend($id: ID!, $email: EmailInput) {\n draftOrderInvoiceSend(id: $id, email: $email) {\n draftOrder {\n id\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DraftOrder/276395349\",\n \"email\": {\n \"subject\": \"valid subject\",\n \"to\": \"invalid recipient\"\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 draftOrderInvoiceSend($id: ID!, $email: EmailInput) {\n draftOrderInvoiceSend(id: $id, email: $email) {\n draftOrder {\n id\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DraftOrder/276395349\",\n \"email\" => [\n \"subject\" => \"valid subject\",\n \"to\" => \"invalid recipient\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "Specifies the draft order to send the invoice for.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/DraftOrder/276395349\"", "typeKind": "MUTATION" }, { "arg": { "name": "email", "description": "Specifies the draft order invoice email fields.", "type": { "kind": "INPUT_OBJECT", "name": "EmailInput", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "EmailInput", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "email", "argValue": " {\"subject\":\"valid subject\",\"to\":\"invalid recipient\"}", "typeKind": "MUTATION" } ] } ]