PHP Sage One会计API

时间:2019-07-02 07:08:06

标签: php sage-one

我正在尝试通过Sage Accounting API调用添加销售发票。但是,我仍然遇到相同的错误,找不到原因。

请求详细信息:

参数:

{
"sales_invoice": {
    "contact_id": "2d06dde3927744f09c60557aae2d1f10",
    "date": "2019-07-01 13:14:56",
    "invoice_lines": [
        {
            "description": "Original remote control JVC RM-C3095",
            "ledger_account_id": "7ccb54ca5df741f0b6cfbb6c35791f93",
            "unit_price": "20.0000",
            "quantity": 1,
            "tax_rate_id": "ES_EXEMPT",
            "eu_goods_services_type_id": "GOODS"
        }
    ],
    "invoice_number_prefix": "INV-",
    "invoice_number": 4,
    "delivery_address": {
        "city": "xxx",
        "address_line_1": "yyy",
        "address_line_2": "zzz",
        "postal_code": "014178"
    },
    "main_address": {
        "city": "xxx",
        "address_line_1": "yyy",
        "address_line_2": "zzz",
        "postal_code": "014178"
    }
}
}

错误:

Array
(
[0] => Array
    (
        [$severity] => error
        [$dataCode] => RecordInvalid
        [$message] => is invalid
        [$source] => line_items.ledger_account
    )

)

即使分类帐帐户ID有效(正如我直接从应用程序中的分类帐帐户中获取的一样)。我该如何解决?

1 个答案:

答案 0 :(得分:0)

请仔细检查您用于销售发票的分类帐帐户是否也在

中列出
const redis = new Redis(
  Object.assign({}, config.redis.server, {
    retryStrategy(times) {
      if (times > 10) {  // reconnect over 10 times closed
        return false;
      }
      return Math.min(times * 100, 3000);
    }
  })
)

这将为您提供可用于销售发票,销售报价,销售信用票据等的有效分类帐帐户列表。

另外,请查看官方documentation about invoicing