# Invoices Endpoint ## Note ``` Check Payment Transactions Documentation for more information on processing the payment. This document focuses on the Invoice Management ``` ## ServiceURL and Payload ### Management #### GenerateOrderID > This endpoint is to generate the InvoiceNumber ##### Endpoint : /api/Transaction/generateorder ##### Payload : ``` { "moduleTag": "string", "tenantID": "uniqueidentifier" } ``` ##### Sample Use: ``` { "moduleTag": "IN", "tenantID": "778df26c-1aab-4f5e-93fd-e4cae2c1bc39" } ``` --- #### CreateInvoice ##### Endpoint : /api/Invoices/createinvoice ##### Payload : ``` { "tenantID": "uniqueidentifier", "customerID": "uniqueidentifier", "invoiceNumber": "string", -- Refer to GenerateOrder endpoint "invoiceDate": "date", "dueDate": "date", --SHOULD NOT BE BEFORE INVOICEDATE "invoiceStatusID": int (default to 1 as this is new) "poNumber": "string", "invoiceTotal": DECIMAL (18,2), "additionsTotal": DECIMAL (18,2), "itemTotals": DECIMAL (18,2), "taxTotal": DECIMAL (18,2), "deductionTotal": DECIMAL (18,2), "balanceDue": DECIMAL (18,2), "invoiceItemString": "string", --IN JSON FORMAT. See note below "additionsString": "string", --IN JSON FORMAT. See note below "deductionString": "string", --IN JSON FORMAT. See note below "taxString": "string", --IN JSON FORMAT. See note below "departmentID": "uniqueidentifier", "invoiceTemplateID": INT, "termsString": "string", "invoiceNotes": "string", "receiptEmail": "string", "receiptSMS": "string", -- Contact Number. Refer to selected information of the customer "creator": "uniqueidentifier", "isDraft": bool (set to False if saved new. True if Save to Draft) } ``` --- #### UpdateInvoice ##### Endpoint : /api/Invoices/updateinvoice ##### Payload : ``` { "invoiceID": "uniqueidentifier", "tenantID": "uniqueidentifier", "invoiceNumber": "string", "customerID": "uniqueidentifier", "invoiceDate": "date", "dueDate": "date", "invoiceStatusID": INT, -- SEE Invoice Status Lookup "poNumber": "string", "invoiceTotal": DECIMAL(18,2), "additionsTotal": DECIMAL(18,2), "itemTotals": DECIMAL(18,2), "taxTotal": DECIMAL(18,2), "deductionTotal": DECIMAL(18,2), "balanceDue": DECIMAL(18,2), "invoiceItemString": "string", --IN JSON FORMAT. See Note below "additionsString": "string", --IN JSON FORMAT. See Note below "deductionString": "string", --IN JSON FORMAT. See Note below "taxString": "string", --IN JSON FORMAT. See Note below "departmentID": "uniqueidentifier", "invoiceTemplateID": 0, "termsString": "string", "invoiceNotes": "string", "receiptEmail": "string", "receiptSMS": "string", "updater": "uniqueidentifier" } ``` --- #### DeleteInvoice ##### Endpoint : /api/Invoices/deleteinvoice ##### Payload : ``` { "invoiceID": "uniqueidentifier", "updater": "uniqueidentifier" } ``` --- #### GetInvoiceDetail ##### Endpoint : /api/Invoices/getinvoicedetail ##### Payload : `InvoiceID : uniqueidentifier` --- #### ListInvoices ##### Endpoint : /api/Invoices/listinvoices ##### Payload : `TenantID : uniqueidentifier` --- ### Payment Transaction #### Endpoint : /api/Transaction/createtransactionlogentry #### Payload : ``` { "tenantID": "uniqueidentifier", "transactionNumber": "string", "transactionModule": "string", -- INVOICE "transactionStatus": "string", -- success or whatever is the error "transactionDetail": "string", -- JSON format / resptext "creator": "uniqueidentifier", "moduleEntry": "string" -- JSON Format (to follow) } ``` --- ### TransactionViewList #### Endpoint : /api/Transaction/transactionviewlist/{module}/{tenantId} #### Payload : ``` module : string tenantId : uniqueidentifier ``` #### Sample : ``` module : IN tenantId : 778DF26C-1AAB-4F5E-93FD-E4CAE2C1BC39 ``` #### Response: ``` [ { "id": "762a415a-644b-4826-a760-8db9fe44eff8", "tenantID": "778df26c-1aab-4f5e-93fd-e4cae2c1bc39", "transactionID": "8e251da9-eee2-4a65-9157-ab7942795655", "departmentID": "6fafea6e-ce76-44b0-a1da-d7facad251fd", "departmentName": "Main", "transactionNumber": "IN2024520BC397576", "customerID": "6844D0DF-4012-438F-95D6-19118E68EAF3", "customerName": "", "amountPaid": 10, "transactionStatus": null, "transactionDate": "2024-05-29T13:51:00" } ] ``` --- ## Notes on JSON Format ### On Invoice Item String * Should contain information that were gathered from the UI * If the item was selected from the inventory, include itemID for tracking purposes ##### Sample ``` { "itemID": "20240619-01", -- For custom items (not selected from inventory), use YYYYMMDD-XX (XX is incremental 2digit number indicating the item id for that specific list) "itemName": "Fuji Apples", "itemPrice": "5.00", "itemCurrency": "USD", "itemDescription": "Apple - Fruit", "itemQty": 12.00, "itemUnit": "Piece", "itemLineAmount": 60.00 } ``` ### On Additions String * This includes the adjustments such as Upcharges or Service Fees (if applicable) * If adjustment was selected from the inventory, include upchargeID ##### Sample ``` { "additionID": "add01", --Make this incremental for specific invoice only "additionName": "Upcharge: 5%", "additionType": "Rate", "additionValue": 5.00, "additionAmount": 3.00 -- computed against the items total } ``` ### On Deduction String * This includes discounts * If adjustment was selected from the inventory, include discountID or DeductionID (anything related to deductions) ### On Tax String * This focuses on tax * Include the Tax Type, Rate, Amount computed * If it was selected from the Tax lookup, include TaxID