# Webhooks

anybill gives third party providers the opportunity to make their services available to merchants via their own AddOn App Store. Depending on the category of the service, the third party provider may have to implement a webhook and inform anybill about it.

This page describes all webhooks that anybill provides.

# Bill Webhook

The bill webhook defines how IDs of bills are transmitted to third party providers so that they can retrieve receipts based on the ID's. The endpoint to which the POST request should be sent is registered by anybill.

# Request

The request object contains an array of IDs with which receipts can be queried via the Bill endpoints of PartnerPlatformAPI.

Request Object

[
    "0bcbfc53-95dd-4fa7-9749-ba93fa6ad623",
    "0bcbfc53-954d-4fc7-97b9-ba93aa6af624"
]

# Couponing Webhook (Preview)

The couponing webhook defines in which format the shopping cart of a purchase is sent to the endpoint of the coupon provider. The coupon provider can then apply discounts and send the shopping cart back to anybill in the appropriate format.

The complete process between POS, anybill and coupon provider looks like this:

couponing flow

# Request

The request object contains an identification and data object.

# The identification object contains information to identify an user or the couponcode.

  • userId identifies a user by the id
  • loyaltyCardBarcode identifies a user by his loyalty card
  • couponCode is the code of the coupon to be applied

# The data object contains all important information about the shopping cart.

  • currency must be a valid three digit ISO 4217 code
  • fullAmountInclVat is the total amount of the shopping cart

# Lines is an array of objects and contains all information about items.

  • sequenceNumber specifies the sequence of the items
  • text contains the name of the item
  • additionalText contains a more detailed description of the item
  • fullAmountInclVat specifies the total amount of the item

# The item object contains detailed information about an item.

  • quantity of the item / product sold or provided service
  • quantity measure of a line item
  • pricePerUnit is the price per unit of an item

# To identify an item, the following attributes can be used:

  • plu is the price lookup code of the item
  • gtin is the global trade item number (ean)
  • posArticleId is the id of the item in the POS system
  • gs1CategoryId is the id of the category in the GS1 system
  • posCategoryId is the id of the category in the POS system

# Possible QuantityMeasure values:

The quantity measure describes the type of quantity of the line item.

Name Value
Count 0
Kilogram 1
Lbs 2
Meters 3
Inches 4
Liter 5
CubicMeters 6
SquareMeters 7

Request Object

{
    "identification": {
        "userId": "0bcbfc53-95dd-4fa7-9749-ba93fa6ad623",
        "loyaltyCardBarcode": "",
        "couponCode": ""
    },
    "data": {
        "currency": "EUR",
        "fullAmountInclVat": 4523.34,
        "lines": [
            {
                "sequenceNumber": 0,
                "text": "Bananas",
                "additionalText": "Organic bananas. Country of origin: Ecuador.",
                "fullAmountInclVat": 1.45,
                "item": {
                    "quantity": 1.753,
                    "quantityMeasure": "Kilogram",
                    "pricePerUnit": 0.75,
                    "identification": {
                        "plu": "",
                        "gtin": "",
                        "posArticleId": "",
                        "gs1CategoryId": "",
                        "posCategoryId": ""
                    }
                }
            }
        ]
    }
}

# Response

The Response object is essentially identical to the Request object. The identification object has been removed. The discountApplied flag has been added, which indicates whether a discount was applied or not. fullAmountInclVatBeforeDiscount indicates what the value of the cart/item was before the discount was applied. The discount object under Item describes the discount applied to an item, whereas the discount object under Data describes discounts applied to the entire shopping cart.

# The discount object contains all information about a discount.

  • sequenceNumber used to order the discounts.
  • discountId is the id of the discount
  • type of the discount
  • text is the name of the discount
  • additionalText describes the discount
  • value of the discount

# Possible Discount values:

The discount type describes the type of a dicount.

Name Value
None 0
Percentage 1
Monetary 2
MonetaryReplacement 3

Response Object

{
    "data": {
        "discountApplied": true,
        "currency": "EUR",
        "fullAmountInclVat": 4523.34,
        "fullAmountInclVatBeforeDiscount": 4523.34,
        "lines": [
            {
                "sequenceNumber": 0,
                "text": "Bananas",
                "additionalText": "Organic bananas. Country of origin: Ecuador.",
                "fullAmountInclVat": 1.45,
                "fullAmountInclVatBeforeDiscount": 1.65,
                "item": {
                    "quantity": 1.753,
                    "quantityMeasure": "Kilogram",
                    "pricePerUnit": 0.75,
                    "PricePerUnitBeforeDiscount": 0.99,
                    "identification": {
                        "plu": "",
                        "gtin": "",
                        "posArticleId": "",
                        "gs1CategoryId": "",
                        "posCategoryId": ""
                    }
                },
                "discounts": [
                    {
                        "sequenceNumber": 0,
                        "discountId": "",
                        "type": "Percentage",
                        "text": "10% on bananas",
                        "additionalText": "This discount only applies to organic bananas for more than 1kg.",
                        "value": 20
                    }
                ]
            }
        ],
        "discounts": [
            {
                "sequenceNumber": 0,
                "discountId": "",
                "type": "Percentage",
                "text": "10% on bananas",
                "additionalText": "This discount only applies to organic bananas for more than 1kg.",
                "value": 20
            }
        ]
    }
}