
Error 10 on submitting an ACCPAY invoice via .net standard OAuth2 wrapper
Hi
On creating an ACCPAY invoice using the Xero.NetStandard.OAuth2.Api we are getting an Error 10 message, with a validation message that doesn't really tell us anything:
"Message": "An error occurred in Xero. Check the API Status page http://status.developer.xero.com for current service status. Contact the API support team at api@xero.com for more assistance."
Below is a snippet of my code, for reference we pass in a valid Xero PurchaseOrder and Contact object to our method
List<LineItem> lines = new List<LineItem>();
foreach (LineItem lineitem in purchaseorder.LineItems)
{
LineItem invoiceline = new LineItem
{
AccountCode = lineitem.AccountCode,
Description = lineitem.Description,
UnitAmount = lineitem.UnitAmount,
ItemCode = lineitem.ItemCode,
Quantity = lineitem.Quantity
};
lines.Add(invoiceline);
}
Invoice invoice = new Invoice
{
Contact = contact,
LineAmountTypes = purchaseorder.LineAmountTypes,
Type = Invoice.TypeEnum.ACCPAY,
Date = DateTime.Now,
LineItems = lines,
InvoiceNumber = purchaseorder.PurchaseOrderNumber,
DueDate = DateTime.Now.AddDays(30)
};
// Post bill to Xero
List<Invoice> invoiceList = new List<Invoice>
{
invoice
};
Invoices invoices = new Invoices
{
_Invoices = invoiceList
};
try
{
Invoices xeroresult = accountingApi.CreateInvoicesAsync(accessToken, tenantId, invoices).Result;
}
catch (Exception ex)
{
return "Fail";
}
On creating an ACCPAY invoice using the Xero.NetStandard.OAuth2.Api we are getting an Error 10 message, with a validation message that doesn't really tell us anything:
"Message": "An error occurred in Xero. Check the API Status page http://status.developer.xero.com for current service status. Contact the API support team at api@xero.com for more assistance."
Below is a snippet of my code, for reference we pass in a valid Xero PurchaseOrder and Contact object to our method
List<LineItem> lines = new List<LineItem>();
foreach (LineItem lineitem in purchaseorder.LineItems)
{
LineItem invoiceline = new LineItem
{
AccountCode = lineitem.AccountCode,
Description = lineitem.Description,
UnitAmount = lineitem.UnitAmount,
ItemCode = lineitem.ItemCode,
Quantity = lineitem.Quantity
};
lines.Add(invoiceline);
}
Invoice invoice = new Invoice
{
Contact = contact,
LineAmountTypes = purchaseorder.LineAmountTypes,
Type = Invoice.TypeEnum.ACCPAY,
Date = DateTime.Now,
LineItems = lines,
InvoiceNumber = purchaseorder.PurchaseOrderNumber,
DueDate = DateTime.Now.AddDays(30)
};
// Post bill to Xero
List<Invoice> invoiceList = new List<Invoice>
{
invoice
};
Invoices invoices = new Invoices
{
_Invoices = invoiceList
};
try
{
Invoices xeroresult = accountingApi.CreateInvoicesAsync(accessToken, tenantId, invoices).Result;
}
catch (Exception ex)
{
return "Fail";
}
3
Replies

Best Reply as chosen by John Dickson (Original Poster)
Hi John and thanks for following up with your workaround. Sorry its so hard to post formatted code here!
This is probably an issue best suited to report in the SDK itself as an issue. My colleague who manages that repo can then discuss and incorporate a fix in a future SDK release.
This is probably an issue best suited to report in the SDK itself as an issue. My colleague who manages that repo can then discuss and incorporate a fix in a future SDK release.