order Invoice Sendmutation
mutation
2024-10latest
Requires write
access scope. Also: The user must have access to orders and manage orders information.
Sends an email invoice for an order.
Arguments
The email input fields for the order invoice. The
bcc
andfrom
fields should be store or staff account emails.The order associated with the invoice.
Was this section helpful?
OrderInvoiceSendPayload returns
The order associated with the invoice email.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: orderInvoiceSend
Query Reference for MUTATION: orderInvoiceSend
"mutation orderInvoiceSend($id: ID!) {\n orderInvoiceSend(id: $id) {\n order {\n # Order fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: orderInvoiceSend
"{\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: orderInvoiceSend
"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: orderInvoiceSend
[ { "example": { "type_name": "orderinvoicesend", "title": "Send invoice", "description": "Send an order invoice to a customer.", "query_string": "mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) {\n orderInvoiceSend(id: $orderId, email: $email) {\n order {\n id\n }\n userErrors {\n message\n }\n }\n}", "variables": { "orderId": "gid://shopify/Order/17181286", "email": { "to": "test@example.net", "from": "Sales Modyl <salesmodel@example.com>", "subject": "Invoice #1001", "customMessage": "Thank you for your order" } }, "response": { "data": { "orderInvoiceSend": { "order": { "id": "gid://shopify/Order/17181286" }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/payments/payment_flexibility/test/unit/graph_api/admin/mutations/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 OrderInvoiceSend($orderId: ID!, $email: EmailInput) { orderInvoiceSend(id: $orderId, email: $email) { order { id } userErrors { message } } }\",\n \"variables\": {\n \"orderId\": \"gid://shopify/Order/17181286\",\n \"email\": {\n \"to\": \"test@example.net\",\n \"from\": \"Sales Modyl <salesmodel@example.com>\",\n \"subject\": \"Invoice #1001\",\n \"customMessage\": \"Thank you for your order\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) {\n orderInvoiceSend(id: $orderId, email: $email) {\n order {\n id\n }\n userErrors {\n message\n }\n }\n }`,\n {\n variables: {\n \"orderId\": \"gid://shopify/Order/17181286\",\n \"email\": {\n \"to\": \"test@example.net\",\n \"from\": \"Sales Modyl <salesmodel@example.com>\",\n \"subject\": \"Invoice #1001\",\n \"customMessage\": \"Thank you for your order\"\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 OrderInvoiceSend($orderId: ID!, $email: EmailInput) {\n orderInvoiceSend(id: $orderId, email: $email) {\n order {\n id\n }\n userErrors {\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"orderId\": \"gid://shopify/Order/17181286\",\n \"email\": {\n \"to\": \"test@example.net\",\n \"from\": \"Sales Modyl <salesmodel@example.com>\",\n \"subject\": \"Invoice #1001\",\n \"customMessage\": \"Thank you for your order\"\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 OrderInvoiceSend($orderId: ID!, $email: EmailInput) {\n orderInvoiceSend(id: $orderId, email: $email) {\n order {\n id\n }\n userErrors {\n message\n }\n }\n }`,\n \"variables\": {\n \"orderId\": \"gid://shopify/Order/17181286\",\n \"email\": {\n \"to\": \"test@example.net\",\n \"from\": \"Sales Modyl <salesmodel@example.com>\",\n \"subject\": \"Invoice #1001\",\n \"customMessage\": \"Thank you for your order\"\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 OrderInvoiceSend($orderId: ID!, $email: EmailInput) {\n orderInvoiceSend(id: $orderId, email: $email) {\n order {\n id\n }\n userErrors {\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"orderId\" => \"gid://shopify/Order/17181286\",\n \"email\" => [\n \"to\" => \"test@example.net\",\n \"from\" => \"Sales Modyl <salesmodel@example.com>\",\n \"subject\" => \"Invoice #1001\",\n \"customMessage\" => \"Thank you for your order\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "email", "description": "The email input fields for the order invoice. The `bcc` and `from` fields should be store or staff account emails.", "type": { "kind": "INPUT_OBJECT", "name": "EmailInput", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "EmailInput", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "email", "argValue": " {\"to\":\"test@example.net\",\"from\":\"Sales Modyl <salesmodel@example.com>\",\"subject\":\"Invoice #1001\",\"customMessage\":\"Thank you for your order\"}", "typeKind": "MUTATION" } ] } ]