My Products
Help
carlacostea
CONTRIBUTOR *

POST Supplier Invoice returns error: Cash Account is invalid.

by carlacostea

Hello,

I am trying to post a supplier Invoice using the api. If my understanding is correct cashAccount is not a required parameter but making a call with no cashAccount defined returns an error :

{
"message": "Error creating supplierInvoice. Cash Account is invalid."
}

This is the object I post:
{
"qs": {},
"body": {
"date": {
"value": "2022-06-20T22:00:00.000Z"
},
"hold": {
"value": false
},
"note": {},
"amount": {},
"dueDate": {},
"payDate": {},
"vatAmount": {},
"currencyId": {},
"locationId": {
"value": "Main"
},
"postPeriod": {},
"cashAccount": {},
"description": {},
"paySelected": {},
"branchNumber": {
"value": "1"
},
"documentType": {
"value": "Invoice"
},
"exchangeRate": {},
"invoiceLines": [
{
"uom": {
"value": "STUK"
},
"note": {},
"branch": {},
"linkLine": {
"purchaseNumber": {},
"purchaseLineNbr": {}
},
"quantity": {
"value": 2
},
"operation": "Insert",
"projectId": {},
"splitLine": {},
"vatCodeId": {},
"lineNumber": {
"value": 1
},
"termEndDate": {},
"branchNumber": {},
"deferralCode": {},
"accountNumber": {
"value": "1540"
},
"projectTaskId": {},
"termStartDate": {},
"undoSplitLine": {},
"costInCurrency": {},
"manualDiscount": {
"value": false
},
"splitHierarchy": {},
"discountPercent": {},
"inventoryNumber": {
"value": "DIVH"
},
"curyRetainageAmt": {},
"deferralSchedule": {},
"unitCostInCurrency": {
"value": 23
},
"transactionDescription": {},
"discountAmountInCurrency": {},
"discountUnitCostInCurrency": {}
}
],
"paymentRefNo": {},
"creditTermsId": {
"value": "30"
},
"paymentMethod": {
"value": "2"
},
"applyRetainage": {
"value": false
},
"paymentMessage": {},
"supplierNumber": {
"value": "30000"
},
"approvalDetails": {
"comment": {},
"attachmentID": {}
},
"financialPeriod": {
"value": "202206"
},
"origInvoiceDate": {},
"referenceNumber": {
"value": "1234"
},
"supplierTaxZone": {},
"cashDiscountDate": {},
"supplierReference": {
"value": "30000"
},
"taxCalculationMode": {},
"validateLineDetails": {},
"overrideNumberSeries": {},
"roundingDiffInCurrency": {}
},
"headers": {
"user-agent": "Make/production",
"authorization": "***",
"ipp-company-id": 4180760,
"content-type": "application/json"
},
"timeout": 40000
}

What am I doing wrong? How can I solve this issue??

Best regards,
Carla

3 REPLIES 3
carlacostea
CONTRIBUTOR *

by carlacostea

Thank you for the response. I fixed the issue above and I followed the instructions to create a supplier invoice in the UI. But I still have an error that I can not identify.

The error body: {
"message": "Error creating supplierInvoice. You cannot set 'Retainage Percent' when 'Apply Retainage' is disabled."
}

The object I post:
{
"qs": {},
"body": {
"date": {
"value": "2022-06-22T22:00:00.000Z"
},
"hold": {
"value": false
},
"note": {},
"amount": {},
"dueDate": {
"value": "2022-07-22T22:00:00.000Z"
},
"payDate": {},
"vatAmount": {},
"currencyId": {},
"locationId": {
"value": "MAIN"
},
"postPeriod": {},
"cashAccount": {
"value": "BANK"
},
"description": {},
"paySelected": {},
"branchNumber": {
"value": "1"
},
"documentType": {
"value": "Purchase Invoice"
},
"exchangeRate": {},
"invoiceLines": [
{
"uom": {
"value": "STUK"
},
"note": {},
"branch": {},
"linkLine": {
"purchaseNumber": {},
"purchaseLineNbr": {}
},
"quantity": {
"value": 2
},
"operation": "Insert",
"projectId": {},
"splitLine": {},
"vatCodeId": {
"value": "3"
},
"lineNumber": {
"value": 1
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "0"
}
],
"termEndDate": {},
"branchNumber": {},
"deferralCode": {},
"retainagePct": {},
"accountNumber": {
"value": "7100"
},
"projectTaskId": {},
"termStartDate": {},
"undoSplitLine": {},
"costInCurrency": {},
"manualDiscount": {},
"splitHierarchy": {},
"discountPercent": {},
"inventoryNumber": {
"value": "DIVH"
},
"curyRetainageAmt": {},
"deferralSchedule": {},
"unitCostInCurrency": {
"value": 23
},
"transactionDescription": {},
"discountAmountInCurrency": {},
"discountUnitCostInCurrency": {}
}
],
"paymentRefNo": {},
"creditTermsId": {
"value": "30"
},
"paymentMethod": {
"value": "1"
},
"applyRetainage": {
"value": false
},
"paymentMessage": {},
"supplierNumber": {
"value": "30001"
},
"approvalDetails": {
"comment": {},
"attachmentID": {}
},
"financialPeriod": {
"value": "202206"
},
"origInvoiceDate": {},
"referenceNumber": {
"value": "1234"
},
"supplierTaxZone": {},
"cashDiscountDate": {},
"supplierReference": {
"value": "30001"
},
"taxCalculationMode": {},
"validateLineDetails": {},
"overrideNumberSeries": {},
"roundingDiffInCurrency": {}
},
"headers": {
"user-agent": "Make/production",
"authorization": "***",
"ipp-company-id": 4180760,
"content-type": "application/json"
},
"timeout": 40000
}

What to do about this? I do not try to set the "Retainage Percent".

Best regards,
Carla

by Magnus Johnsen

We recommend not sending fields that you are not using, please try to send this JSON instead first:

{
"date": {
"value": "2022-06-22T22:00:00.000Z"
},
"hold": {
"value": false
},
"dueDate": {
"value": "2022-07-22T22:00:00.000Z"
},
"locationId": {
"value": "MAIN"
},
"cashAccount": {
"value": "BANK"
},
"branchNumber": {
"value": "1"
},
"documentType": {
"value": "Purchase Invoice"
},
"invoiceLines": [
{
"uom": {
"value": "STUK"
},
"quantity": {
"value": 2
},
"operation": "Insert",
"vatCodeId": {
"value": "3"
},
"lineNumber": {
"value": 1
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "0"
}
],
"accountNumber": {
"value": "7100"
},
"inventoryNumber": {
"value": "DIVH"
},
"unitCostInCurrency": {
"value": 23
},
}
],
"creditTermsId": {
"value": "30"
},
"paymentMethod": {
"value": "1"
},
"applyRetainage": {
"value": false
},
"supplierNumber": {
"value": "30001"
},
"financialPeriod": {
"value": "202206"
},
"referenceNumber": {
"value": "1234"
},
"supplierReference": {
"value": "30001"
}
}

by Magnus Johnsen

Hi,

The cash account is most likely fetched from the supplier, please make sure the cash account set on your supplier is valid:

2022-06-23 16_15_45-Suppliers - Brave.png

We would also recommend that you try to enter the invoice in the UI, this should point you to where the issue occurs. 

Thank you.