Expenses

The Expenses Import Endpoint

https://{BASE_URL}/imports/expenses

All import integration endpoints use the same authentication parameters, please see Authentication page for more details.

Advanced Expense Import Parameters

When importing Expenses you can additionally specify which Markets you wish to import for. The default market is dk (Denmark).

This default can be overridden by the query parameter markets. The value for the parameter is a comma separated lists of markets.

E.g.:

https://{BASE_URL}/imports/expenses?markets=dk,se,no&...

For further clarification of the Market concept, please read the Vocabulary.

Importing Expenses

Send a POST request to the endpoint with the parameters specified above.

The body of the POST request must be a JSON object with the following layout:

{
    "expenses": [
        [expense A],
        [expense B],
        ...
    ]
}

The definition of the Expense model can be found in the Models document. The minimal data required for an expense is an id and a name:

{
    "expenses": [
        {
            "id": "0001",
            "name": "Catering"
        },
        {
            "id": "0002",
            "name": "External catering"
        }
    ]
}

NOTE

When expenses are imported into the Ka-ching system, the id will be used as a unique key.

One limitation in the database we are using (the Firebase real-time database) is that not all characters are valid to use in keys.

This means that the following list of characters may not be used in the "id" field of an expense: ., /, #, $, *, [ and ]

The only other property of an expense is a list of taxes.

By not specifying any taxes, the default value added taxes for the relevant market will be used.

Note that the value added taxes of an expense are 'incoming taxes' while taxes from sold goods are 'outgoing taxes'. They will be registered as such on the Z-report.

Different countries have different value added taxes for different kinds of expenses. In Denmark we have a lowered VAT for dining out with clients ('repr├Žsentation'). We have no VAT for catering at the shop - for instance when buying pizzas when doing stock counts. And finally we have regular VAT when buying items relevant to running the shop - paper, scissors, etc.

In order to specify 'no VAT' you need to add a tax with 0% since just leaving out the tax means that the default tax for the market is being applied.

Importing expenses with specific taxes

{
    "expenses": [
        {
            "id": "0001",
            "name": "Forplejning",
            "taxes": [ {
                    "name": "Ingen moms",
                    "rate": 0,
                    "type": "vat"
            } ]
        },
        {
            "id": "0002",
            "name": "Forplejning ude af huset",
            "taxes": [ {
                    "name": "Kvartmoms",
                    "rate": 0.0625,
                    "type": "vat"
            } ]
        }
    ]
}

Importing expenses with market specific taxes

If you import the same expenses for several different markets, you can specify an array of taxes per market as follows:

{
    "expenses": [
        {
            "id": "0001",
            "name": "Forplejning",
            "taxes": {
                "da": [ {
                        "name": "Ingen moms",
                        "rate": 0,
                        "type": "vat"
                } ],
                "no": [ {
                        "name": "Lav moms",
                        "rate": 0.01,
                        "type": "vat"
                } ],
            }
        },
        {
            "id": "0002",
            "name": "Forplejning ude af huset",
            "taxes": {
                "da": [ {
                        "name": "Kvartmoms",
                        "rate": 0.0625,
                        "type": "vat"
                } ],
                "no": [ {
                        "name": "Halvmoms",
                        "rate": 0.125,
                        "type": "vat"
                } ],
            }
        }
    ]
}

Deleting Expenses

Send an HTTP DELETE request to the endpoint with a body containing a JSON object containing expense ids to delete.

{
  "ids": ["0001", "0002"]
}