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

调用Xero API POST新西兰员工openingBalances返回400错误如何解决?

解决方案

核心问题

当前请求体结构不符合Xero NZ薪资期初余额接口的嵌套规范,接口无法识别到有效期初余额条目,因此触发400错误。

修正要点

  • 外层必须包裹openingBalances对象,明细条目放在该对象下的openingBalance数组字段中,不可直接提交明细数组
  • 需补全新西兰地区强制要求的薪资扣除类字段,即使金额为0也需显式声明
  • periodEndDate使用YYYY-MM-DD格式即可,无需携带时间后缀
  • 请求头需显式指定Content-Type: application/json,确保租户ID对应开通NZ薪资模块的企业实例

正确请求体示例

{
  "openingBalances": {
    "openingBalance": [
      {
        "periodEndDate": "2011-01-30",
        "daysPaid": 5.00,
        "unpaidWeeks": 0.00,
        "grossEarnings": 1442.31,
        "paye": 0.00,
        "kiwiSaverEmployeeContribution": 0.00,
        "kiwiSaverEmployerContribution": 0.00,
        "childSupport": 0.00,
        "studentLoan": 0.00
      }
    ]
  }
}

内容的提问来源于stack exchange,提问作者Tommy Sharp

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 19:12:02