4.1 Customer Invoices Master
Interface
It allows you:
to insert new customer invoices (master document)
to process existent customer invoices (Change Document Action: Prepare, Complete, Void etc)
to update, delete existing invoices
for update it is necessary to provide all the updatable fields in JSON even if the value is not changed. The missing fields will get their value removed!
delete will remove all the related details!
Prerequisites:
In order to use this API Method for PUT there must be accomplished the following requirements in SocrateCloud:
to have an Organization active
to have a Customer active with all the mandatory fields
to have a price list active
Columns that can be used as filters:
Organization
OrderNo
OrderReference
DocumentNo
BillBPartner
IsPaid
DateInvoiced
TrackingNo
Actions can be done:
create
update
print invoices
Customer Invoice fields (Master and Details)
An Invoice in SocrateCloud has the following structure:
Master document which contains data about header document:
No. document
Invoice date
Customer
Sales Representative etc.
Document details which contains the products that are invoiced with informations about:
Product
Quantity
Selling price
VAT
Note: We recommend attending the following steps:
If new customer, create customer using BPartner create method
Create Invoice with DocumentAction=null ⇒ the result will be a Customer Invoice with DocumentStatus='Draft', e.g. DocumentNo: 60300
Create Invoice lines into the Customer Invoice no: 60300
Process Customer Invoice no: 60300 using process method by sending the following parameters: Document Number and Document Action.
API Methods:
Create:
URL: https://api.socratecloud.com/webapi/rest/invoice/create/{version}?accessToken={access_token}
Method: POST
Return: document no for success or error message (start with "ERROR: ")
Data format:
{
"Organization": "DEMO SRL",
"OrderNo": null,
"OrderReference": null,
"Description": "some description",
"DocType": "AR Invoice",
"DateInvoiced": "2023-05-01 00:00:00+0000",
"FixedDate": false,
"BillBPartner": "CT1",
"BillBPartnerName": "CLIENT TEST 1",
"BillLocation": "Sediu_contabilitate",
"BillContact": "contact CT1",
"Currency": "RON",
"SalesRep": "ANGAJAT DEMO 1",
"BillBPartnerSR": "AD1",
"BillBankAccount": "RO43INGB0000000000009988",
"PriceList": "Vanzare RON",
"DateRegistered": null,
"PaymentTerm": "15 days",
"MeanOfConveyance": null,
"MeanOfConveyanceName": null,
"MOCSalesRepName": null,
"MOCSalesRepDescription": null,
"TrxOrganization_ID": 1005354,
"TrxOrganizationValue": "SERVICE",
"TrxOrganization": "SERVICE",
"Project_ID": 1022150,
"ProjectValue": "BC001",
"Project": "BC001",
"ProjectPhase_ID": 1014515,
"ProjectPhase": "A",
"ProjectTask_ID": 1004859,
"ProjectTask": "sub_I",
"Activity_ID": 1000475,
"ActivityValue": "Testare",
"Activity": "Testare",
"Campaign_ID": 1000685,
"CampaignValue": "1000001",
"Campaign": "Campanie testare DEV",
"Asset_ID": 1005114,
"AssetValue": "1000005",
"Asset": "LIVRABIL DEMO",
"User1_ID": null,
"User1": null,
"Employee_ID": 1043712,
"Employee": "ANGAJAT DEMO 1",
"IsSelfService": false,
"PaymentMethod": "On Credit",
"DocumentStatus": "Drafted",
"DocumentAction": "Complete",
"PaymentMode": "OP",
"ReceiptNo": 1,
"AMEF": 1,
"TrackingNo": null
}
Update:
URL: https://api.socratecloud.com/webapi/rest/invoice/update/{version}?accessToken={access_token}&DocumentNo={document_no}
Method: POST
Return: document no for success or error message (start with "ERROR: ")
Data format:
{
"Organization": "DEMO SRL", // NOT UPDATABLE !!! (business logic reason)
"OrderNo": null,
"OrderReference": null,
"Description": "some description",
"DocType": "AR Invoice",
"DateInvoiced": "2023-05-01 00:00:00+0000",
"FixedDate": false,
"BillBPartner": "CT1", // NOT UPDATABLE !!! (business logic reason)
"BillBPartnerName": "CLIENT TEST 1",
"BillLocation": "Sediu_contabilitate",
"BillContact": "contact CT1",
"Currency": "RON",
"SalesRep": "ANGAJAT DEMO 1",
"BillBPartnerSR": "AD1",
"BillBankAccount": "RO43INGB0000000000009988",
"PriceList": "Vanzare RON", // NOT UPDATABLE !!! (business logic reason)
"DateRegistered": null,
"PaymentTerm": "15 days",
"MeanOfConveyance": null,
"MeanOfConveyanceName": null,
"MOCSalesRepName": null,
"MOCSalesRepDescription": null,
"TrxOrganization_ID": 1005354,
"TrxOrganizationValue": "SERVICE",
"TrxOrganization": "SERVICE",
"Project_ID": 1022150,
"ProjectValue": "BC001",
"Project": "BC001",
"ProjectPhase_ID": 1014515,
"ProjectPhase": "A",
"ProjectTask_ID": 1004859,
"ProjectTask": "sub_I",
"Activity_ID": 1000475,
"ActivityValue": "Testare",
"Activity": "Testare",
"Campaign_ID": 1000685,
"CampaignValue": "1000001",
"Campaign": "Campanie testare DEV",
"Asset_ID": 1005114,
"AssetValue": "1000005",
"Asset": "LIVRABIL DEMO",
"User1_ID": null,
"User1": null,
"Employee_ID": 1043712,
"Employee": "ANGAJAT DEMO 1",
"IsSelfService": false,
"PaymentMethod": "On Credit",
"DocumentAction": "<None>",
"PaymentMode": "OP",
"ReceiptNo": 1,
"AMEF": 1,
"TrackingNo": null
}
Note: If you don't transmit a field, then the value of that field will be deleted!! (except of not updatable fields)
Delete:
URL: https://api.socratecloud.com/webapi/rest/invoice/delete/{version}?accessToken={access_token}&DocumentNo={document_no}
Method: POST
Return: 'Deleted' for success or error message (start with "ERROR: ")
Process:
URL: https://api.socratecloud.com/webapi/rest/invoice/process/{version}?accessToken={access_token}&DocumentNo={document_no}&DocumentAction={document_action}
Method: POST
Optional parameters:
VoidReason - Void reason name as defined in SocrateCloud. Applicable only for DocumentAction = 'Void' or 'Reverse - Correct'.
Return: Document status for success or error message (start with "ERROR: ")
Print Fiscal Receipt:
URL: https://api.socratecloud.com/webapi/rest/invoice/print_fiscal_receipt/{version}?accessToken={access_token}&DocumentNo={document_no}
Method: POST
Optional parameters:
Language (eg: ”ro_RO”, ”en_EN”, ”bg_BG” etc) - if it is null or unprovided then the english is the base language
Return: Document no for success or error message (start with "ERROR: ")