Skip to main content

Interface

Versions​

Curerrent unified version: unified version

VersionDateChanges
unified version01-06-2025Initial Release

Fields​

FieldTypeDescription
invoice_fromstringThe name of the company that issues the invoice
invoice_typestringThe type of invoice (sales or purchase)
invoice_client_namestringThe name of the client
invoice_client_companystringThe company name of the client
invoice_client_billing_autobooleanWhether the client is billed automatically or not
invoice_client_billing_periodstringThe billing period of the client
invoice_referencestringThe reference of the invoice
invoice_datestringThe date of the invoice
invoice_itemsccsInvoiceItems[]The items of the invoice
invoice_due_datestringThe due date of the invoice
ccsInvoiceItems
item_descriptionstringThe description of the item
item_quantitynumberThe quantity of the item
item_pricenumberThe price of the item
item_periodstringThe period of the item
item_tax_ratestringThe tax rate of the item
item_ledger_accountstringThe ledger account of the item

Functions​

FunctionDescription
createSalesInvoiceCreates a sales invoice
getPurchaseInvoiceDocumentGets the purchase invoice document
createPurchaseInvoiceCreates a purchase invoice
updatePurchaseInvoiceUpdates a purchase invoice
mapSalesInvoiceDataMaps the sales invoice data
mapPurchaseInvoiceDataMaps the purchase invoice data

All functions require the following parameters:

  • payload: The payload of the invoice, this can be ccsSalesInvoice or ccsPurchaseInvoice
  • auth_fields: The authentication fields, this can be admin_id and token

All functions return the following:

  • response: The response of the function which contains status and data an example can be seen below

If the function is successful, it returns the following:

{
"status": "success",
"data": {
// data
}
}

If the function fails, it returns the following:

{
"status": "error",
"error": "error message"
}

TS interface​

export interface ccsSalesInvoice {
invoice_from: string,
invoice_type: string,
invoice_client_name: string,
invoice_client_company: string,
invoice_client_billing_auto: boolean,
invoice_client_billing_period: string,
invoice_reference: string,
invoice_date: string,
invoice_items: ccsInvoiceItems[]
}

export interface ccsPurchaseInvoice {
invoice_from: string,
invoice_type: string,
invoice_reference: string,
invoice_date: string,
invoice_due_date: string,
invoice_items: ccsInvoiceItems[]
}

export interface ccsInvoiceItems {
item_description: string,
item_quantity: number,
item_price: number,
item_period?: string
item_tax_rate: string
item_ledger_account: string
}