AlmondTill/G3N API

createVendorInvoice

mutation · in the family Purchasing

What it does

Create a new vendor’s invoice — what a supplier billed you against a purchase at your organization.

Create a VendorInvoice: the parent PO past-issue (cancelled/draft/pending refuse CONFLICT/REF_STATE); the billing OrgVendor (defaulted to the PO vendor) active; every Money in the PO snapshot currency; at-least-one-of matchLines/actualComponents (the Contact substance stance); each match line names an existing PO line. The (invoiceOrgVendor × normalized invoice number) uniq pair mints IN the create transaction — a live (draft or captured) holder refuses CONFLICT/IDENTITY_TAKEN naming it (the double-pay gate); a cancelled holder is taken over.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Purchasing — Purchase orders, returns to vendors, vendor invoices and supplier records.

Roles that may call it:

Arguments

NameTypeRequiredNotes
inputCreateVendorInvoiceInput CreateVendorInvoiceInput!yesCreate-input for createVendorInvoice.

Returns

VendorInvoice VendorInvoice! — A captured vendor bill: the 3-way match and the landed-cost true-up run from it at capture. NOT a payables subledger. Parent = the PO (the match is per-PO; N invoices per PO are legal — partial-shipment invoicing); invoiceOrgVendorId MAY differ from the PO vendor: ONE construct covers merchandise invoices (match lines) AND cost bills (landed actual components) — either or both, never neither. Capture stamps matchStatus matched|flagged at tolerance zero and posts the landed true-up. The (invoiceOrgVendor x normalized invoice number) uniq pair is the double-pay gate (CONFLICT/IDENTITY_TAKEN naming the holder; a cancelled holder is taken over). captured is the immutable fact (corrections are compensating entries, never un-capture); cancelled is the doomed terminal (lists filter it).

Example request

graphql
mutation ExampleCreateVendorInvoice($input: CreateVendorInvoiceInput!) {
  createVendorInvoice(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    invoiceOrgVendorId
    invoiceNumber
    invoiceDate
    notes
    matchStatus
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "purchaseOrderId": "01900000-0000-7000-8000-da3499da0000",
    "invoiceNumber": "<invoice number>",
    "invoiceDate": "2027-01-31"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "createVendorInvoice": {
      "id": "01900000-0000-7000-8000-2bdde69a0000",
      "sysId": "VI-EXMP-0000-000F",
      "type": "VendorInvoice",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-da3499da0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "invoiceOrgVendorId": "01900000-0000-7000-8000-ba06d1ac0000",
      "invoiceNumber": "<invoice number>",
      "invoiceDate": "2027-01-31",
      "notes": "Restock before the weekend.",
      "matchStatus": "matched"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in