我可以在C#中使用XeroCoreApi获取发票URL吗?

时间:2019-08-03 08:38:45

标签: c# xero-api

我可以在C#中使用XeroCoreApi获取发票URL吗?

我有以下代码,将付款网关处理付款后的发票标记为已付款。我想将用户重定向到发票。

Payment payment = new Payment();
Invoice payingInvoice = _api.Invoices.Find("xyz");

payment.Invoice = payingInvoice;
Account payingAccount = new Account();
payingAccount.Code = "xyz";
payment.Account = payingAccount;
payment.Amount = "xyz";
payment.Date = DateTime.Now;
_api.Payments.Create(payment);
Response.Redirect("INVOICE_URL"); //Here should be the Invoice URL

1 个答案:

答案 0 :(得分:1)

您可以使用组织短代码(来自组织端点)和发票ID来构建发票URL,如下所示:

https://go.xero.com/organisationlogin/default.aspx?shortcode= {ORG_SHORTCODE}&redirecturl = / AccountsReceivable / View.aspx?InvoiceID = {INVOICE_ID}

这称为深度链接,在此处记录:

https://developer.xero.com/documentation/api-guides/deep-link-xero