

# Architecture and Data Flow

The diagram below gives a high-level overview of how the anybill platform is
structured and how receipt data flows between the point of sale, anybill's
backend services, the customer, and connected third parties.

<ZoomableImage
    src="https://developer.anybill.de/images/anybill_architecture_and_data_flow.png"
    alt="anybill architecture and data flow diagram showing receipt data flowing from the Merchant POS through anybill's services to the customer and third-party systems"
    caption="Click the diagram to enlarge."
    open-label="Open architecture diagram in a larger view"
/>

## Participants

The diagram is organised into five zones that represent the different actors
and systems involved in a digital receipt journey.

### Merchant POS
The point of sale is where every receipt is born. Modern cash registers as
well as legacy POS systems transmit receipt data — and, if available, a
receipt URL — to the anybill backend via the [Vendor API](https://developer.anybill.de/vendor_api/) or
through one of the [Vendor API SDKs](https://developer.anybill.de/vendor_api_sdk/overview).

### anybill
anybill is the central platform that receives, stores, enriches, and
distributes receipt data. Its core building blocks are:

- **Vendor API** — receives receipt data from POS systems.
- **App API** — serves customer-facing applications, authenticated via an
  auth token.
- **Partner Platform API** — exposes configuration, basic analytics, and
  receipt data to partners (see [Partner Platform API](https://developer.anybill.de/partner_platform_api/)).
- **Receipt Data Storage** — the secure, encrypted store for all receipts
  (see [Security and Compliance](https://developer.anybill.de/security_and_compliance/)).
- **Purchase Intelligence** — aggregates analytics data derived from
  receipts.
- **Webhook Service** — pushes and serves receipt data to connected third
  parties (see [Webhooks](https://developer.anybill.de/webhooks/overview)).

### Known Customer, Merchant App, Merchant CRM
Customers who are already known to the merchant — for example because they
use the merchant's app or are part of the merchant's CRM — receive their
receipts directly in the merchant's frontend. Integration is done through
the [anybill Frontend SDKs](https://developer.anybill.de/the_anybill_sdk/overview) (Android, iOS,
Flutter, React Native, Web), which authenticate against anybill using an
auth token and fetch customer receipts from the App API in real time.

### Unknown Customer
Walk-in customers without a prior relationship to the merchant can still
receive a digital receipt. The cash register or customer display shows a
QR code that links to the anybill
[receipt retrieval website](https://getmy.anybill.de/). The customer scans
the QR code with the standard smartphone camera — no app install required —
and can then download the receipt as a PDF, send it by email, add it to a
wallet, or pick it up inside an existing merchant app.

### Third Party, Loyalty, Retail Media
Connected third parties — such as loyalty programs, retail media networks,
or analytics vendors — consume receipt data through the anybill Webhook
Service. Receipt data is either **pushed** to a registered endpoint or
**pulled** by the third party on demand. See
[Webhooks](https://developer.anybill.de/webhooks/overview) for the available events and payloads.

## Typical Data Flow

A typical transaction moves through the platform in the following order:

1. The **Merchant POS** transmits receipt data (and, where supported, a
   receipt URL) to the anybill **Vendor API**.
2. anybill stores the receipt securely in the **Receipt Data Storage**.
3. Depending on how the customer is identified, the receipt is delivered
   via one of three paths:
   - **Known customer** — the merchant's app or website fetches the
     receipt from the **App API** using the Frontend SDK.
   - **Unknown customer** — the customer scans a QR code on the customer
     display and retrieves the receipt from the anybill retrieval website.
   - **Connected payment method** — anybill matches payment information
     provided by a PSP/acquirer with the receipt data and delivers the
     receipt automatically.
4. In parallel, relevant receipt data can be optionally forwarded to **third-party**
   systems via the Webhook Service.

## Where to go next

- [Vendor API](https://developer.anybill.de/vendor_api/) — integrate your POS with anybill.
- [Frontend SDKs](https://developer.anybill.de/the_anybill_sdk/overview) — deliver receipts inside
  your customer-facing app or website.
- [Partner Platform API](https://developer.anybill.de/partner_platform_api/) — programmatic access
  for partners.
- [Webhooks](https://developer.anybill.de/webhooks/overview) — receive receipt data as events.
- [Security and Compliance](https://developer.anybill.de/security_and_compliance/) — how anybill
  protects receipt data at rest and in transit.
