Bill Reference Number not populating in Xero API

时间:2019-05-31 11:44:29

标签: xero-api

I'm creating a bill (supplier invoice) in Xero API (C# .Net). Everything populates perfectly except for the Reference number which remains blank.

Excerpt:

var invoiceObject = new Invoice
{
    Reference = "TEST123", 
    Contact = contact,
    Date = DateTime.Now,
    DueDate = DateTime.Now,
    ExpectedPaymentDate = DateTime.Now,
    Status = Xero.Api.Core.Model.Status.InvoiceStatus.Draft,
    LineItems = lineItems,
    Type = Xero.Api.Core.Model.Types.InvoiceType.AccountsPayable
};

var invoice = api.Invoices.Create(invoiceObject);

The following screenshot demonstrates the issue:

Screenshot of issue

Every other field, lineitem, tax code, etc. populates perfectly.

I've tried different combinations of upper and lowercase characters, numbers, etc. but it doesn't work.

If I log in to Xero, open the Invoice and manually enter TEST123 an save the invoice, it works perfectly.

I've also tried saving the invoice, then editing it and re-saving in the API and the reference still does not populate.

How can I set the reference in the API?

1 个答案:

答案 0 :(得分:0)

快速解答

Xero Invoice API docs表示您无法设置ACCPAY发票的参考值,但是无论您输入的发票编号(ACCPAY发票上的唯一字段)都将出现在参考中字段。

说明

我遇到了同样的问题。我在Xero的支持论坛上找到了此评论:

https://community.xero.com/developer/discussion/40489223

...这样说:

  

目前,根据   发票是销售发票(ACCREC)或购买发票/账单   (ACCPAY)。对于账单,参考编号显示在发票编号中   元素,请查看我们在发票here上解释的文档   这会更详细。


从链接到文档

Invoice API Doc notes

总而言之,您帖子中包含的屏幕截图确实具有“参考”输入,但这不是发票参考值的输入-这是针对您针对付款所输入的付款的可能参考值的输入发票。发票的参考值显示在到期日旁边的顶部:

enter image description here