# Loyalty Receipt Webhook

The Loyalty Receipt Webhook extends the default receipt notification with additional loyalty-specific information.
It allows anybill to act as the connecting layer between POS systems and loyalty providers, forwarding enriched receipt data that can include loyalty transactions, rewards, or return markers.

This webhook can be used to handle both standard purchase receipts and return receipts while passing along the loyalty data needed by your system.

The content of the loyalty information is flexible and can be adapted to meet the data requirements of each individual loyalty provider.


# Loyalty Flow Overview

The diagram below illustrates the high-level flow of how anybill interacts as a connector between POS systems and loyalty providers:

  1. A transaction is started at the POS (e.g. qr code or customer card scanned)
  2. anybill transmits receipt and couponing information to the loyalty provider.
  3. The loyalty provider applies coupons and rewards.
  4. User and activated coupon data is returned.
  5. The final enriched receipt data is processed.
  6. The webhook is triggered and delivered to your system.
Loyalty Flow

# Use Cases

  • Loyalty integrations
    Forward purchase and return receipts to your loyalty provider system, including all relevant loyalty extensions such as transaction IDs, redeemed rewards, or applied benefits.

  • Rewards management
    Identify rewards that were redeemed within a purchase or returns that should adjust a user’s loyalty balance.

  • Custom loyalty data
    Extend the webhook payload to match the requirements of your loyalty provider. For example, additional coupon metadata, membership identifiers, or custom tracking fields.


# Webhook Request Structure

The base payload is the same as the default Receipt Notification Webhook, with an additional loyaltyInformation object.

# LoyaltyInformation Example

This loyalty payload is an example which data can be transfered. We can modify it to fit your required data (customerIds, points, coupons).

Property Name Type Description
isReturnReceipt Boolean Indicates whether the receipt represents a return transaction.
transactionId String The transaction identifier used to match the loyalty system’s records.
redeemedRewards Array An array of redeemed rewards (structure depends on loyalty provider needs).

# Example: Loyalty Receipt

{
  "receiptId": "d550649f-cc56-48c6-952a-2320ad287a8e",
  "receiptNr": "021020244",
  "storeId": "1eaf6958-3b51-4ee9-aeb3-013d8b66940d",
  "externalStoreId": "location_1",
  "externalId": "6546642",
  "date": "2024-07-07T16:18:43+02:00",
  "vendorAddress": {
    "countryCode": "Deutschland",
    "postalCode": "81543",
    "city": "München",
    "street": "Musterstraße 1"
  },
  "vendorName": "MyShop GmbH",
  "amount": 21.14,
  "lines": [
    {
      "amount": 19.99,
      "name": "T-Shirt",
      "number": "1",
      "quantity": "1,0",
      "qty": 1,
      "quantityMeasure": 0,
      "pricePerUnit": 19.99
    },
    {
      "amount": 3.98,
      "name": "Kaugummi",
      "number": "1",
      "quantity": "1,0",
      "qty": 1,
      "quantityMeasure": 0,
      "pricePerUnit": 3.98
    }
  ],
  "loyaltyInformation": {
    "isReturnReceipt": false,
    "transactionId": "a58eef99-f504-48aa-ab3c-f2e3dca84441",
    "redeemedRewards": [
      {
        "customIdentifier": "123455"
      }
    ]
  }
}

# Example: Return Receipt

{
  "receiptId": "f98d1dd7-70d4-4c09-a8e2-c4d74d0bc1ef",
  "receiptNr": "081020244",
  "storeId": "1eaf6958-3b51-4ee9-aeb3-013d8b66940d",
  "externalStoreId": "location_1",
  "externalId": "6546642",
  "date": "2024-10-08T21:05:15.648887+02:00",
  "vendorAddress": {
    "countryCode": "Deutschland",
    "postalCode": "81543",
    "city": "München",
    "street": "Musterstraße 1"
  },
  "vendorName": "MyShop GmbH",
  "amount": -3.98,
  "lines": [
    {
      "amount": -3.98,
      "name": "Kaugummi",
      "number": "1",
      "quantity": "1,0",
      "qty": 1,
      "quantityMeasure": 0,
      "pricePerUnit": 3.98
    }
  ],
  "loyaltyInformation": {
    "isReturnReceipt": true,
    "transactionId": "a58eef99-f504-48aa-ab3c-f2e3dca84441"
  }
}

This webhook makes it possible to connect purchase and return events with your loyalty logic, while keeping the payload adaptable to provider-specific requirements.