Skip to content

Expense/Tariff Lines & Multiple Purchase Orders

This is a supplemental technical guide covering two related capabilities and how they appear in the data Invoice Automation sends to your ERP solution: mixing Expense and Tariff lines with Purchase lines on a single invoice, and matching a single invoice against more than one Purchase Order. It's aimed at anyone consuming the AIP export payload, or configuring a Vendor/Company for these behaviours, rather than day-to-day document processing.

Info

Both features are gated by ERP-level settings and are not available by default - contact support if you need them enabled for your organisation.

Expense, Tariff & Purchase line types

A single Purchase Invoice can contain a mix of line types on the same document. Each row in the Line Details table is classified internally as one of three types:

  • Purchase - a line matched to a Purchase Order line, as normal.
  • Expense - a non-PO cost, coded to a GL/Nominal account like a line on an Expense Invoice.
  • Tariff - a duty/tariff charge, also coded to a GL/Nominal account.

Tariff line detection requires two ERP-level features to both be enabled: Tariff Support and Mixed Purchase and Expense Lines. Without both enabled, a Tariff amount can only be captured as a single header-level value rather than as individual Tariff lines.

Multiple Purchase Orders per invoice

When the Allow Multiple Purchase Orders Per Invoice setting is enabled for your organisation, and the invoice's Line Details table has a Purchase Order Number detected on individual lines (rather than a single number in the document header), the Line Matching Dialog resolves and matches each distinct Purchase Order the invoice references independently.

You cannot merge/match invoice lines that span more than one Purchase Order in a single action - if lines belong to different Purchase Orders they must be matched separately, one Purchase Order at a time.

Validation (missing lines, order totals, GRN matching, etc.) also runs independently per Purchase Order, rather than once for the whole document - see Document Validation Errors for the specific messages this can produce.

How this appears in the exported data

Invoice Automation publishes one of three Aptean Integration Platform (AIP) event types when a document is exported, chosen automatically based on the line types present:

Event When
invoice-automation-purchase-invoice-exported-v1 Every line is a Purchase line
invoice-automation-expense-invoice-exported-v1 Every line is an Expense (or Tariff) line, no Purchase lines
invoice-automation-mixed-invoice-exported-v1 At least one Purchase line alongside at least one Expense or Tariff line

Every entry in the lines array carries its own lineType (purchase, expense, or tariff), so a consumer can route each amount to the correct GL/AP treatment without needing to re-derive it from other fields.

For Purchase lines, purchaseOrderNumber and purchaseOrderLineUniqueId identify which Purchase Order and Purchase Order line that specific row was matched to. Expense and Tariff lines omit both fields and instead carry a nominal (GL account) code.

Multi-PO invoices leave the header PO number blank

The Purchase Order Number on the payload's header section only ever reflects the single legacy Purchase Order Number field. On an invoice matched to more than one Purchase Order, this header value is not populated - you must read the Purchase Order number from each entry in the lines array to reconstruct which Purchase Order(s) an invoice was matched against, rather than relying on a single header value.

Example payload

The following shows a mixed invoice matched against two Purchase Orders, with an Expense line and a Tariff line also present:

{
  "companyUniqueId": "COMP-0042",
  "createdDate": "2026-09-17T10:15:00.000Z",
  "documentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "documentUrl": "https://app.example.com/document/original/3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "supplierId": "b3f1c2a0-1234-4a11-9c9d-1234567890ab",
  "supplierName": "Acme Freight Supplies",
  "supplierUniqueId": "SUP-1001",
  "organisation": "acme",
  "header": {
    "companyName": "Acme Freight Supplies",
    "companyBranch": "01",
    "invoiceNumber": "INV-88231",
    "invoiceDate": "2026-09-10T00:00:00.000Z",
    "dueDate": "2026-10-10T00:00:00.000Z",
    "documentType": "Invoice",
    "documentVariant": "Invoice",
    "subtotal": 1450.00,
    "vatTotal": 145.00,
    "carriage": 25.00,
    "discount": 0,
    "tariff": 60.00,
    "total": 1680.00,
    "supplierEmail": "[email protected]",
    "supplierRegistrationNumber": "REG-55123",
    "supplierVatRegistrationNumber": "GB123456789"
  },
  "lines": [
    {
      "lineType": "purchase",
      "purchaseOrderNumber": "PO-100234",
      "purchaseOrderLineUniqueId": "e2c1a9f0-11aa-4bb2-9c33-a1b2c3d4e5f6",
      "code": "WIDGET-A",
      "description": "Widget A - 10mm",
      "quantity": 100,
      "unitPrice": 5.00,
      "value": 500.00,
      "rowIdentifier1": "1",
      "grnLines": [
        { "grnLineUniqueId": "grn-line-uid-1", "grnUniqueId": "grn-uid-1", "quantityUsed": 100 }
      ]
    },
    {
      "lineType": "purchase",
      "purchaseOrderNumber": "PO-100987",
      "purchaseOrderLineUniqueId": "9a8b7c6d-22bb-4cc3-8d44-b2c3d4e5f6a7",
      "code": "WIDGET-B",
      "description": "Widget B - 20mm",
      "quantity": 50,
      "unitPrice": 19.00,
      "value": 950.00,
      "rowIdentifier1": "2",
      "grnLines": [
        { "grnLineUniqueId": "grn-line-uid-2", "grnUniqueId": "grn-uid-2", "quantityUsed": 50 }
      ]
    },
    {
      "lineType": "expense",
      "code": "FREIGHT",
      "description": "Freight surcharge",
      "quantity": 1,
      "unitPrice": 25.00,
      "value": 25.00,
      "nominal": "6100-FREIGHT"
    },
    {
      "lineType": "tariff",
      "code": "TARIFF",
      "description": "Import tariff",
      "quantity": 1,
      "unitPrice": 60.00,
      "value": 60.00,
      "nominal": "7200-TARIFF"
    }
  ],
  "links": [
    {
      "approvedDate": "2026-09-12T09:00:00.000Z",
      "approvedUser": "Jane Doe",
      "approvedUserId": "u-1234"
    }
  ]
}

Notes on this example:

  • The header's Purchase Order Number is intentionally absent - see the warning above. Only single-PO invoices (Multiple Purchase Orders disabled, or only one PO referenced) populate this field.
  • The two purchase lines each carry a different purchaseOrderNumber, demonstrating the multi-PO case.
  • purchaseOrderNumber/purchaseOrderLineUniqueId are omitted entirely from Expense and Tariff lines rather than sent as null.
  • The tariff line above represents an actual Tariff row detected on the invoice. If no Tariff rows exist but a header-level Tariff value is present, Invoice Automation synthesises a single fallback Tariff line from that header value instead.
  • Fields with no value are omitted from the real payload rather than sent as null/undefined - this example only shows fields that are actually populated for this scenario.