---
title: "How to invoice an order"
description: "Guide on invoicing orders using GraphQL mutation. Includes example query, result, and parameter descriptions for generating invoices and credit note reports."
lang: en
languages:
  en: https://docs.vismasoftware.no/businessnxtapi/examples/howto/invoice_order/index.md
lastmod: 2026-07-10
---

> Documentation index: https://docs.vismasoftware.no/businessnxtapi/examples/howto/llms.txt


# How to invoice an order

Last modified July 10, 2026

> Guide on invoicing orders using GraphQL mutation. Includes example query, result, and parameter descriptions for generating invoices and credit note reports.


To invoice an order, you must first finish the order. You can run the `invoicesAndCreditNotes` report on the `Order` table in order to invoice an order, as shown in the following example:

```graphql { title = "Query" }
mutation invoice_order($cid : Int!,
                      $ono : [Int]!)
{
  useCompany(no : $cid)
  {
    order_reports
    {
      invoicesAndCreditNotes(
        filter:{orderNo :{_in : $ono}},
        returnDocuments : true,
        printDestination : PRINT_TO_PDF,
        approval : true
      )
      {
        succeeded
        documents
        {
          name
          content
          attachments
          {
            name
            content
          }
        }
      }
    }
  }
}
```

```graphql { title = "Result" }
{
  "data": {
    "useCompany": {
      "order_reports": {
        "invoicesAndCreditNotes": {
          "succeeded": true,
          "documents": [
            {
              "name": "1000013.pdf",
              "content": "JVBERi0xLjQKJdD...",
              "attachments": []
            }
          ]
        }
      }
    }
  }
}
```

The parameters have the following meaning:

| Parameter | Description |
| --------- | ----------- |
| `filter` | The filter to apply to the report. In this case, we are filtering by the order number (one or more orders). |
| `returnDocuments` | If set to `true`, the report will return the invoice document. |
| `printDestination` | The destination where the invoice will be printed. In this case, we are printing to a PDF file. |
| `approval` | It updates the tables when set to `true` (the default value). Set to `false` to only preview results. |

> [!TIP]
>
> The content of the returned documents (and attachments) is base64-encoded. You must decode it to get the original file.


---

[View this page](https://docs.vismasoftware.no/businessnxtapi/examples/howto/invoice_order/)
