You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于Xero API手工日记账LineAmount是否需总和归零的技术问询

Xero Manual Journals API: Do Journal Line Amounts Need to Balance?

Great question—this is a key point tied directly to double-entry accounting principles that Xero enforces strictly, even for draft journals.

Core Rule: Line Amounts Must Sum to Zero

Yes, all LineAmount values in your JournalLines array must add up to exactly zero. This is non-negotiable for both draft and approved manual journals in Xero.

Negative amounts typically represent credits, positive amounts represent debits (or vice versa, depending on how you structure your entries)—but regardless of the sign convention, the total of all line amounts must net to zero to maintain the fundamental accounting equation. If this balance isn’t met, the Xero API will return an error and reject your request, even for draft entries.

Looking at Your Example

Let’s calculate the total of your proposed line amounts:

  • -1000.00 + 132.00 + 31.00 + 97.00 = -740.00

This total isn’t zero, so this request would fail. To fix it, you’d need to add an additional line (or adjust existing amounts) to bring the total to zero. For example, you could add a line like:

{
  "Description": "Offsetting Prepayment",
  "LineAmount": 740.00,
  "AccountCode": "[appropriate account code]",
  "TaxType": "NONE"
}

Adjusted Valid Example

Here’s what your payload would look like once balanced:

{
  "Date": "2014-08-13",
  "Status": "DRAFT",
  "Narration": "This is some random text",
  "LineAmountTypes": "NoTax",
  "JournalLines": {
    "JournalLine": [
      {
        "Description": "Prepaid Annual Phone",
        "LineAmount": -1000.00,
        "AccountCode": "489",
        "TaxType": "NONE"
      },
      {
        "Description": "Prepayment",
        "LineAmount": 132.00,
        "AccountCode": "620",
        "TaxType": "NONE"
      },
      {
        "Description": "Prepayment",
        "LineAmount": 31.00,
        "AccountCode": "620",
        "TaxType": "NONE"
      },
      {
        "Description": "Prepayment",
        "LineAmount": 97.00,
        "AccountCode": "620",
        "TaxType": "NONE"
      },
      {
        "Description": "Offsetting Prepayment",
        "LineAmount": 740.00,
        "AccountCode": "489",
        "TaxType": "NONE"
      }
    ]
  },
  "ShowOnCashBasisReports": "false"
}

Final Note

Even when creating draft journals, Xero enforces this balancing rule to ensure that once you’re ready to approve the journal, it adheres to standard accounting practices. So always double-check that your line amounts net to zero before sending the API request.

内容的提问来源于stack exchange,提问作者Gene Smith

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 17:12:45