HTTP Operation Type Object DTO Why-DTOs?
Mutation createPurchaseInvoice PurchaseInvoiceCreateGLDtoInput
Mutation updatePurchaseInvoice PurchaseInvoiceUpdateGLDtoInput
Mutation deletePurchaseInvoice PurchaseInvoiceDeleteGLDtoInput
Query purchaseInvoices filtered by id Why?  
Query purchaseInvoices  

Description

Both known as Purchase Invoices in the API context and in the product interface.
This resource is pivotal for managing payments to suppliers after receiving goods or services and serves as a legally binding documentation of the purchase.

The Purchase Invoices entity utilizes a simplified model that primarily includes key information of the purchase invoice: invoice number, invoice date, fulfillment date, total amount, amount excluding tax, and taxes.
This ensures compliance and contributes to a smoother accounts payable process.

img

Workflow
  1. Create the Invoice and Optionally View or Modify It: Start by creating a purchase invoice using the PurchaseInvoice service.
    Once created, you can view and make any necessary modifications to the invoice before finalizing it.

  2. Post the Invoice to Generate Accounting Entries: Proceed with posting the invoice using the PostPurchaseInvoice service.
    Posting the invoice will generate the necessary accounting entries, making the invoice part of the company’s financial records.

  3. View the Invoice’s Payment Due Dates: Check the payment due dates and related information using the PurchaseInvoiceOpenItems service.
    This allows you to see when payments are expected and track outstanding amounts for the invoice.

  4. Apply Partial or Full Payments to the Invoice: Manage the payments on the invoice by using the PurchaseOpenItemSettlement service.
    You can apply both partial and full payments, keeping track of amounts paid and any remaining balances.


To see examples of mutations that include the adding of :
download the Postman collection: Quick start / 5. Test your first query in Postman

graphQL Mutation
mutation ($values: PurchaseCreateGLDtoInput!) {  
    createPurchaseInvoice(input: $values) {
    id
  }
}
graphQL Variables
{
  "values": {
    "supplierId": "b647b9e4-6d2a-4c9d-96e3-54be55457096",
    "invoiceDate": "2024-08-19",
    "invoiceNumber": "AA123",
    "totalLiquid": 240,
    "firstDueDate": "2024-08-19T00:00:00+00:00",
    "hasCashVat": false,
    "operationDate": "2024-08-19T00:00:00+00:00",
    "pendingAmount": 240,
    "vatLines": [
      {
        "invoiceDate": "2024-08-19T00:00:00+00:00",
        "totalVat": 40,
        "totalVatBase": 200
        "purchaseAccountingAccountId":"550e8400-e29b-41d4-a716-446655440000",
        "taxGroupId":"123e4567-e89b-12d3-a456-426614174000",
        "taxId":"f47ac10b-58cc-4372-a567-0e02b2c3d479",
        "taxTreatmentId":"9a19d7f2-c524-41fc-9e7f-d59775cd8953"
      }
    ]
  }
}
Example of Response
{
    "data": {
        "createPurchaseInvoice": {
            "id": "e451aff7-074f-4e72-a6fb-4ea25e9d9c64"
        }
    }
}
Key Value
Authorization Bearer Current access Token How to find?
X-TenantId Current tenant id How to find?
X-OrganizationId Current organization Id How to find?
x-api-key Primary or secondary subscription key of your app How to find?

purchaseInvoices

Fields Type Description Length
id UUID ID  
       
invoiceDate DateTime Date when the invoice was issued  
firstDueDate DateTime The first due date for payment of the invoice  
invoiceNumber String Document number of the invoice 50
operationDate DateTime Fulfillment date  
supplier Supplier Fields of supplier  
supplierId UUID ID of the supplier entity  
pendingAmount Decimal Amount still due on the invoice  
status String
  • Pending
  • Closed
  • Posted
  • PartiallyPaid
  • Paid
  • PartiallyOverdue
  • Overdue
 
totalLiquid Decimal Total amount due including taxes  
hasCashVat Boolean Indicates if the invoice is subject to Cash VAT  
vatLines[] Array Vat lines of purchase Invoice  
Info
  • operationDate: The date cannot be later than the invoice date.
  • status:
    • Pending: (Pending) The invoice can be modified; it has not yet been transferred to accounting.
    • Closed: (Pending) The invoice was supposed to be transferred to accounting, but the operation failed or was canceled..
    • Posted: (Awaiting payment) The invoice can no longer be modified; it has been transferred to accounting.
    • PartiallyPaid: (Partially paid) The invoice is partially paid. Payments are pending.
    • Paid: (Paid) The invoice is fully paid.
    • PartiallyOverdue: (Partially overdue) The invoice is partially paid. Payments are overdue.
    • Overdue: (Overdue) The invoice is not paid. All payments are overdue.

purchaseInvoices/vatLines

Fields Type Description Length
id UUID ID  
       
vatPercentage Decimal VAT percentage (only for mutations)  
totalVat Decimal Total VAT amount calculated for the invoice.  
totalVatBase Decimal Total VAT base amount (before tax) for the invoice.  
       
tax Taxes Fields of Tax including percentage  
taxId UUID ID for the tax applied to the invoice.  
taxTreatment TaxTreatment Fields of TaxTreatment  
taxTreatmentId UUID ID for the tax treatment applied to the invoice  
purchaseAccountingAccount AccountingAccount Fields of AccountingAccount  
purchaseAccountingAccountId UUID ID Account  
Info
  • vatPercentage: The percentage of VAT applicable to this line.
    Used only for mutations to simplify specifying the tax percentage for the line.
    In this case, taxId should not be provided, as it will be automatically inferred based on the VAT percentage.
  • taxId: The unique identifier of the tax to be applied.
    Not required in mutations if vatPercentage is set, as the system will select the appropriate tax automatically based on the VAT percentage.
  • taxTreatmentId: The ID of the tax treatment that determines how the tax is handled.
    Optional in mutations, if not specified the system will select the first tax treatment consistent with the tax rate automatically.
  • purchaseAccountingAccountId: The ID of the accounting account applicable to this line.
    Optional in mutations, if not specified the system will automatically choose the first account consistent with the tax rate.
  • taxes{percentage}: In queries, this allows retrieving the tax percentage, as vatPercentage is only available for mutations.

purchaseInvoices/openItems

An Open Item is a financial transaction that allows you to know if it has been fully settled or paid.
Each open item includes detailed information such as the total amount, accumulated amount paid, and the payment due date.

For a single invoice, there can be as many open items as there are different payment installments, which is why openItems is structured as an array to accommodate multiple entries per invoice.

The payment status provides insight into the progress of settling each item.
Additionally, the identifier of the payment method used is provided to track the settlement method.

img

Fields Type Description
id UUID Unique identifier of the item
     
amount Decimal Total amount of the item
creationDate DateTime Creation date of the item
modificationDate DateTime Last modification date of the item, null if not modified
paidAmountAccumulated Decimal Accumulated amount that has been paid
dueDate DateTime Due date for the payment
status
  • NOT_SPECIFIED
  • PAID
  • PARTIAL
Status of the payment
paymentMean PaymentMean Fields of PaymentMean
paymentMeanId UUID Identifier of the payment method used
Info
  • amount : Total amount due for the open item.
  • creationDate : Indicates when the item was initially created.
  • modificationDate : Timestamp of the last update to the item, null if no updates have been made.
  • paidAmountAccumulated : Total amount that has been paid towards the item up to the current date.
  • dueDate : Date by which the payment for the item is due.
  • status: Represents the current status of the payment, indicating the extent to which the item has been settled. The possible values are:
    • NOT_SPECIFIED: No specific payment status has been detailed.

    • PAID: Payment has been fully made to suppliers.
    • PARTIAL: Payment for the item has been made partially.