Invoice Examples Document Change API

Documentation •
In this article

Example adding an Invoice

the following example shows how to use document change to create invoices with Document Change in Banana. These rows can only be inserted in the Invoices table using the Estimates and Invoices application. The Invoice JSON object represents the data structure through which a new invoice can be created.


{
  "format": "documentChange",
  "error": "",
  "data": [
    {
      "document": {
        "dataUnits": [
          {
            "nameXml": "Invoices",
            "data": {
              "rowLists": [
                {
                  "rows": [
                    {//Invoice 1
                      "operation": {
                        "name": "add"
                      },
                      "fields": {
                         (Invoice JSON Object)
                     },
                     {//Invoice 2
                       "operation": { 
                         "name": "add" 
                      }, 
                      "fields": { 
                         (Invoice JSON Object)
                    }
                  ]
                }
              ]
            }
          }
        ]
      },
      "creator": {
        "executionDate": "2021-09-13",
        "name": "extension_name.js",
        "version": "1.0"
      }
    }
  ]
}


Assure that the JSon Invoice Object is valid

It is advisable to check that the JSon Invoice Object is valid. Therefore:

  • Create a Json Invoice Object.
  • Pass the object to the function Calculate invoice.
  • Add the object to the document change

 

Help us improve the documentation

We welcome feedback on how to improve this page.

Tell us what theme needs a better explanation or how to clarify a topic.

Share this article: Twitter | Facebook | LinkedIn | Email