I am building integration with our own internal system to created invoices via the API on request.
I am getting the following returned error
{"Errors":{"Error":["Payload is missing."]}}
My request code is as follows
request.post(url, data, (error, res, body) => {
if (error) {
console.error(error);
return;
}
console.log(body);
});
and my data code is as below
var data = {
"payload": {
"Header": {
"MessageType": "Request",
"SubmissionNumber": timestamp,
"Authentication": {
"AccNumber": accountNumber,
"MD5Value": preHash,
"ApplicationID": app_id
}
},
"Body": {
"InvoiceData": {
"InvoiceType": "INVOICE",
"ClientID": "1343151",
"ClientAddress": {
"Address": "123 Test Street<br/>Manchester<br/>MA1 5TH<br/>United Kingdom",
"CountryISO": "GB"
},
"Currency": "GBP",
"TermDays": "14",
"Language": "en",
"InvoiceLines": {
"ItemLines": {
"ItemLine": [
{
"ItemID": "0",
"ItemName": "BC1",
"ItemDescription": "300 Business Cards (250gsm)",
"ItemNominalCode": "4000",
"Tax1": {
"TaxName": "VAT",
"TaxPercentage": "20.00",
"TaxAmount": "20"
},
"UnitCost": "100",
"Qty": "1"
},
{
"ItemID": "0",
"ItemName": "EMB1",
"ItemDescription": "Embossing Stamp",
"ItemNominalCode": "4000",
"Tax1": {
"TaxName": "VAT",
"TaxPercentage": "20.00",
"TaxAmount": "10"
},
"UnitCost": "50",
"Qty": "1"
}
]
}
},
"Scheduling": {
"SingleInvoiceData": {
"IssueDate": "2017-05-23"
}
}
}
}
}
}
I have generated a submission number and converted the MD5 value etc for the authentication. I am guessing there is something wrong with my formatting, Please can someone help. Tanks