POST v2/invoice/TaxCalculation

Calculates the tax for an invoice based on the provided request details.

Request Information

URI Parameters

None.

Body Parameters

The containing invoice and group information for tax calculation.

InvoiceTaxCalculationRequest
NameDescriptionTypeAdditional information
invoiceId

Provide the InvoiceId

integer

None.

invoiceNumber

Provide the invoice number.

string

Required

calculationRunId

Provide the calculation run identifier for this tax calculation request.

string

None.

taxEngineName

Provide the tax calculation Engine Name deafult is 'Internal'.

string

Required

groups

Provide the list of tax groups associated with the invoice.

Collection of InvoiceTaxGroup

Required

Request Formats

application/json, text/json

Sample:
{
  "invoiceId": 1,
  "invoiceNumber": "sample string 1",
  "calculationRunId": "sample string 2",
  "taxEngineName": "sample string 3",
  "groups": [
    {
      "itemNumber": "sample string 1",
      "items": [
        {
          "invoiceItemLineId": 1,
          "objectId": 2,
          "objectType": "sample string 3",
          "taxCode": "sample string 4",
          "lineSubTotal": 5.1
        },
        {
          "invoiceItemLineId": 1,
          "objectId": 2,
          "objectType": "sample string 3",
          "taxCode": "sample string 4",
          "lineSubTotal": 5.1
        }
      ]
    },
    {
      "itemNumber": "sample string 1",
      "items": [
        {
          "invoiceItemLineId": 1,
          "objectId": 2,
          "objectType": "sample string 3",
          "taxCode": "sample string 4",
          "lineSubTotal": 5.1
        },
        {
          "invoiceItemLineId": 1,
          "objectId": 2,
          "objectType": "sample string 3",
          "taxCode": "sample string 4",
          "lineSubTotal": 5.1
        }
      ]
    }
  ]
}

application/xml, text/xml

Sample:
<InvoiceTaxCalculationRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <InvoiceId>1</InvoiceId>
  <InvoiceNumber>sample string 1</InvoiceNumber>
  <CalculationRunId>sample string 2</CalculationRunId>
  <TaxCalculationEngineName>sample string 3</TaxCalculationEngineName>
  <groups>
    <InvoiceTaxGroup>
      <itemId>sample string 1</itemId>
      <items>
        <TaxItem>
          <invoiceItemLineId>1</invoiceItemLineId>
          <objectID>2</objectID>
          <objectType>sample string 3</objectType>
          <taxCode>sample string 4</taxCode>
          <lineSubTotal>5.1</lineSubTotal>
        </TaxItem>
        <TaxItem>
          <invoiceItemLineId>1</invoiceItemLineId>
          <objectID>2</objectID>
          <objectType>sample string 3</objectType>
          <taxCode>sample string 4</taxCode>
          <lineSubTotal>5.1</lineSubTotal>
        </TaxItem>
      </items>
    </InvoiceTaxGroup>
    <InvoiceTaxGroup>
      <itemId>sample string 1</itemId>
      <items>
        <TaxItem>
          <invoiceItemLineId>1</invoiceItemLineId>
          <objectID>2</objectID>
          <objectType>sample string 3</objectType>
          <taxCode>sample string 4</taxCode>
          <lineSubTotal>5.1</lineSubTotal>
        </TaxItem>
        <TaxItem>
          <invoiceItemLineId>1</invoiceItemLineId>
          <objectID>2</objectID>
          <objectType>sample string 3</objectType>
          <taxCode>sample string 4</taxCode>
          <lineSubTotal>5.1</lineSubTotal>
        </TaxItem>
      </items>
    </InvoiceTaxGroup>
  </groups>
</InvoiceTaxCalculationRequest>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'InvoiceTaxCalculationRequest'.

Response Information

Resource Description

MidnightAPIResponseOfInvoiceTaxAdvanceModel
NameDescriptionTypeAdditional information
isSuccessful

boolean

None.

returnErrors

MidnightErrorResponse

None.

data

InvoiceTaxAdvanceModel

None.

Response Formats

application/json, text/json

Sample:
{
  "isSuccessful": true,
  "returnErrors": {
    "ErrorMessage": [
      {
        "Key": "sample string 1",
        "Message": "sample string 2"
      },
      {
        "Key": "sample string 1",
        "Message": "sample string 2"
      }
    ]
  },
  "data": {
    "calculationRunId": "sample string 2",
    "taxEngineName": "sample string 3",
    "itemDetails": [
      {
        "itemNumber": "sample string 1",
        "invoiceId": 2,
        "invoiceNumber": "sample string 3",
        "invoiceLineItemId": 4,
        "objectId": 5,
        "objectType": "sample string 6",
        "taxCode": "sample string 7",
        "taxSurtaxCap": 1.1,
        "taxable": true,
        "taxRate": 9.0,
        "taxablePercent": 10.0,
        "lineSubTotal": 11.1,
        "taxableLineSubTotal": 12.1,
        "calculatedTaxAmount": 13.1,
        "surtaxCapLimit": 1.1,
        "surtaxCapApplied": true
      },
      {
        "itemNumber": "sample string 1",
        "invoiceId": 2,
        "invoiceNumber": "sample string 3",
        "invoiceLineItemId": 4,
        "objectId": 5,
        "objectType": "sample string 6",
        "taxCode": "sample string 7",
        "taxSurtaxCap": 1.1,
        "taxable": true,
        "taxRate": 9.0,
        "taxablePercent": 10.0,
        "lineSubTotal": 11.1,
        "taxableLineSubTotal": 12.1,
        "calculatedTaxAmount": 13.1,
        "surtaxCapLimit": 1.1,
        "surtaxCapApplied": true
      }
    ]
  }
}