Accounting API Documentation

This API will be deprecated in the near future. You can refer to the new Orderline API Documentation.

Overview

Get settlements and report of that settlement in json and CSV format.

Steps to get Accounting data

Step 1

Fetch sync able settlement_ids of a Location
Required Scope: prod/accounting
URL: https://favrit.com/ws/accounting-api-service/v1/api/accounting/locations/<location_id>/settlements
Optional request parameter: status
Method: GET
Header: Authorization Bearer access_token

Request Sample:

curl --location --request GET 'https://favrit.com/ws/accounting-api-service/v1/accounitng/locations/<locationId>/settlements/<settlementId>' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json'

Response Sample:

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
    "status": "SUCCESS",
    "data": {
        "settlements": [
            {
                "settlementId": 19005,
                "locationId": 10818,
                "creationDate": "2021/09/27"
            },
            {
                "settlementId": 131214,
                "locationId": 10818,
                "creationDate": "2021/10/07"
            },
            {
                "settlementId": 131213,
                "locationId": 10818,
                "creationDate": "2021/10/07"
            },
            {
                "settlementId": 131215,
                "locationId": 10818,
                "creationDate": "2021/10/07"
            },
            {
                "settlementId": 141818,
                "locationId": 10818,
                "creationDate": "2021/10/08"
            }
        ]
    }
}

Remarks: The response says there are five settlement reports needed to be synced. Date is represented as ISO format.

Step 2

Fetching accounting report for specific location_id and settlement_id
Required Scope: prod/accounting
URL: https://favrit.com/ws/accounting-api-service/v1/api/accounting/locations/<location_id>/settlements/<settlement_id>/reports?type=json
Method: GET
Header: Authorization Bearer access_token
Request Param: type values “json” or “csv“

Request Sample:

curl --location --request GET 'https://favrit.com/ws/accounting-api-service/v1/accounitng/locations/<locationId>/settlements/<settlementId>/reports?type=json' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json'

Response Sample:

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
    "status": "SUCCESS",
    "data": {
        "transactionRef": "Wvx5i0vPsxxozVoKQ",
        "locationId": 10818,
        "settlementId": 2473,
        "fromDateTime": "2021-10-14T22:00:00",
        "toDateTime": "2021-10-15T21:00:00",
        "deliveryFee": 1.25,
        "tipsAmount": 1.00,
        "totalPaymentFee": 0.24,
        "accountLines": [
            {
                "accountName": "Beer",
                "accountReference": "3020",
                "sumWithoutVat": 0.80,
                "sumWithVat": 1.00,
                "vatPercent": 0.25,
                "vatAmount": 0.20,
                "quantity": 1
            },
            {
                "accountName": "Wine",
                "accountReference": "3010",
                "sumWithoutVat": 1.60,
                "sumWithVat": 2.00,
                "vatPercent": 0.25,
                "vatAmount": 0.40,
                "quantity": 2
            },
            {
                "accountName": "Mat",
                "accountReference": "3000",
                "sumWithoutVat": 0.80,
                "sumWithVat": 1.00,
                "vatPercent": 0.25,
                "vatAmount": 0.20,
                "quantity": 1
            },
            {
                "accountName": "Mineralwater",
                "accountReference": "3030",
                "sumWithoutVat": 1.60,
                "sumWithVat": 2.00,
                "vatPercent": 0.25,
                "vatAmount": 0.40,
                "quantity": 2
            }
        ]
    }
}

Step 3

Update the transaction_ref to complete the process and mark as completed
Required Scope: prod/accounting
URL:  https://favrit.com/ws/accounting-api-service/v1/api/accounting/locations/<location_id>/settlements/<settlement_id>
Method: PUT
Header: Authorization Bearer access_token
Request Param: status values “complete”

Request Sample:

Update the transaction_ref to complete the process and mark as completed
Required Scope: prod/accounting
URL:  https://favrit.com/ws/accounting-api-service/v1/api/accounting/locations/<location_id>/settlements/<settlement_id>
Method: PUT
Header: Authorization Bearer access_token
Request Param: status values “complete”

Response Sample:

HTTP/1.1 204 NO CONTENT
Content-Type: application/json;charset=UTF-8

Remarks: Synced completed now

Step 4

Get CSV output of Accounting Report
Required Scope: prod/accounting
URL: https://favrit.com/ws/accounting-api-service/v1/api/accounting/locations/<location_id>/settlements/<settlement_id>/reports?type=csv
Method: GET
Header: Authorization Bearer access_token

Request Sample:

curl --location --request GET 'https://favrit.com/ws/accounting-api-service/v1/accounitng/locations/<locationId>settlements/<settlementId>/reports?type=csv' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: text/csv'

Response Sample:

HTTP/1.1 200 OK
Content-Type: text/csv

Location ID,From Date Time,To Date Time,Account Name,Account Code/Number,Type,VAT Percent,VAT Amount,Sum without VAT,Sum with Vat,Quantity,Payment Fee
10818,2021-10-14T22:00,2021-10-15T21:00,Beer,3020,ACCOUNT_LINE,0.25,0.20,0.80,1.00,1
10818,2021-10-14T22:00,2021-10-15T21:00,Wine,3010,ACCOUNT_LINE,0.25,0.40,1.60,2.00,2
10818,2021-10-14T22:00,2021-10-15T21:00,Mat,3000,ACCOUNT_LINE,0.25,0.20,0.80,1.00,1
10818,2021-10-14T22:00,2021-10-15T21:00,Mineralwater,3030,ACCOUNT_LINE,0.25,0.40,1.60,2.00,2
10818,2021-10-14T22:00,2021-10-15T21:00,,,TIPS_AMOUNT,,,,1.00,
10818,2021-10-14T22:00,2021-10-15T21:00,,,DELIVERY_FEE,,,,,
10818,2021-10-14T22:00,2021-10-15T21:00,,,BANK_FEES,,,,0.24,